Using the default package - is there a special compiler flag?

Discussion in 'Java' started by Bura Tino, May 8, 2004.

  1. Bura Tino

    Bura Tino Guest

    Hi,

    I know that it is illegal to use a class from the default package in a named
    package. But JBuilder 7 is able to somehome circumvent this problem even
    though it is set up with a recent sdk. Does anyone know if JBuilder sets a
    special flag that I can also set manually to get the same effect?

    I'm using badly written libraries that put some key classes in the default
    package.

    Thank you very much in advance. A positive response will make my life a
    whole lot easier.

    Bura
     
    Bura Tino, May 8, 2004
    #1
    1. Advertising

  2. Bura Tino

    Neal Gafter Guest

    Bura Tino wrote:
    > I know that it is illegal to use a class from the default package in a named
    > package. But JBuilder 7 is able to somehome circumvent this problem even
    > though it is set up with a recent sdk. Does anyone know if JBuilder sets a
    > special flag that I can also set manually to get the same effect?


    JBuilder has its own compiler that doesn't yet implement this constraint.
     
    Neal Gafter, May 9, 2004
    #2
    1. Advertising

  3. Bura Tino

    Bura Tino Guest

    "Neal Gafter" <> wrote in message
    news:...
    > Bura Tino wrote:
    > > I know that it is illegal to use a class from the default package in a

    named
    > > package. But JBuilder 7 is able to somehome circumvent this problem even
    > > though it is set up with a recent sdk. Does anyone know if JBuilder sets

    a
    > > special flag that I can also set manually to get the same effect?

    >
    > JBuilder has its own compiler that doesn't yet implement this constraint.
    >

    Not sure this is so. JBuilder allows you choose your own SDK. I guess it's
    possible that they only use the VM and not the compiler.

    But in any case, was your answer pertaining to JBuilder or was it
    essentially "no, there's no way to enable javac to do that"?

    Thanks

    Bura
     
    Bura Tino, May 9, 2004
    #3
  4. On Sun, 09 May 2004 00:33:32 GMT, Bura Tino wrote:
    > "Neal Gafter" ..wrote in message
    >> Bura Tino wrote:
    >>> I know that it is illegal to use a class from the default package in a

    > named
    >>> package. But JBuilder 7 is able to somehome circumvent this problem even
    >>> though it is set up with a recent sdk.

    ....
    >> JBuilder has its own compiler that doesn't yet implement this constraint.
    >>

    > Not sure this is so.


    (chuckles) Trust me. Neal knows more about
    compilers (particularly javac) than most of
    us ever want to know. ;-)

    >...JBuilder allows you choose your own SDK.


    So does javac.. You use the -bootclasspath
    option to point it at any rt.jar, I do so in my
    on-line compiler, which even allows people to
    compile code aginst the MSVM..
    <http://www.physci.org/javac.jsp?bcp=MS>

    >...I guess it's
    > possible that they only use the VM and not the compiler.
    >
    > But in any case, was your answer pertaining to JBuilder or was it
    > essentially "no, there's no way to enable javac to do that"?


    The way I read Neal's comment,
    no, javac cannot do that.

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
     
    Andrew Thompson, May 9, 2004
    #4
  5. Bura Tino

    Neal Gafter Guest

    Bura Tino wrote:
    > But in any case, was your answer pertaining to JBuilder or was it
    > essentially "no, there's no way to enable javac to do that"?


    There is no way to enable javac to do that. It's not allowed by the language
    specification, which is why the reference implementation doesn't support it.
    With the exception of the -source flag that selects among the versions of the
    language specification javac is asked to comply with, there are no compiler
    flags that are intended to relax the set of programs javac will accept.
     
    Neal Gafter, May 9, 2004
    #5
  6. Bura Tino

    Bura Tino Guest

    "Neal Gafter" <> wrote in message
    news:...
    > Bura Tino wrote:
    > > But in any case, was your answer pertaining to JBuilder or was it
    > > essentially "no, there's no way to enable javac to do that"?

    >
    > There is no way to enable javac to do that. It's not allowed by the

    language
    > specification, which is why the reference implementation doesn't support

    it.
    > With the exception of the -source flag that selects among the versions of

    the
    > language specification javac is asked to comply with, there are no

    compiler
    > flags that are intended to relax the set of programs javac will accept.
    >


    This answer is very clear an unequivocal. Thank you.

    I'm still left wondering how those library developers compiled their code.
    (In particular, I'm talking about the lamentable JMatLink.)

    Also, is it suprising in the context of language specification, that once a
    "packaged" class A, which uses the "default-packaged" class B is compiled
    (by that old and special JBuilder compiler) it can be then used on all vm's?
     
    Bura Tino, May 9, 2004
    #6
  7. Bura Tino

    Neal Gafter Guest

    Bura Tino wrote:
    > I'm still left wondering how those library developers compiled their code.
    > (In particular, I'm talking about the lamentable JMatLink.)


    Using older or noncompliant compilers.

    > Also, is it suprising in the context of language specification, that once a
    > "packaged" class A, which uses the "default-packaged" class B is compiled
    > (by that old and special JBuilder compiler) it can be then used on all vm's?


    Not surprising. The JVM is a completely different language than Java, though it
    is intended to support Java well.
     
    Neal Gafter, May 10, 2004
    #7
  8. Bura Tino

    Dale King Guest

    Hello, Neal Gafter !
    You wrote:

    > Bura Tino wrote:
    > > But in any case, was your answer pertaining to JBuilder or

    was it
    > > essentially "no, there's no way to enable javac to do that"?

    >
    > There is no way to enable javac to do that. It's not allowed

    by the language
    > specification, which is why the reference implementation

    doesn't support it.

    I realize that you are an expert on javac matters, but I think
    you are overstating what the spec says. I was in many discussions
    on thos topic years ago when it was allowed by javac and the only
    compiler that didn't support it was Visual AgeFor Java. There
    were people who claimed VAJ was non-compliant because it didn't
    support.

    The spec does not forbid importing from the unnamed package, but
    does allow a host to not support it. A system can support it and
    would not be non-compliant as you claimed in another message,
    otherwise javac was non-compliant before 1.3.
    --
    Dale King
    My Blog: http://daleking.homedns.org/Blog
     
    Dale King, Apr 15, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. popman

    Is there a design-time flag?

    popman, May 23, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,311
    mikeb
    May 24, 2004
  2. mrhicks
    Replies:
    3
    Views:
    346
    James Dow Allen
    Sep 1, 2004
  3. Terry
    Replies:
    2
    Views:
    416
    Terry
    Jul 3, 2011
  4. Ben Harper
    Replies:
    0
    Views:
    250
    Ben Harper
    Aug 22, 2006
  5. Replies:
    2
    Views:
    351
Loading...

Share This Page