Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

sun jdk-1-5-0 compiler bug

Thread view: 
Reinhard B. - 22 Dec 2005 23:17 GMT
Hello!

Here is a bug, that all versions of SUN java 1-5-0 compilers seem to have.

The bug is, that a class, extending a base class, cannot be compiled
(because of a (wrong) error message), except you compile
both base class and sub class together.

Try this:
Write to classes, store them in appropriate files:

--------------------Base.java--------------------
public class Base {

    protected class Inner <T> {
    }

    protected Inner<String> constructInnerOfString (String s) {
        return new Inner<String>();
    }

}
--------------------/Base.java--------------------

--------------------Sub.java--------------------
public class Sub extends Base {

    private Inner<String> innerStr = constructInnerOfString("");

}
--------------------/Sub.java--------------------

Now compile:
  javac -classpath .  Base.java Sub.java
It works.

Now compile only the sub class:
  javac -classpath .   Sub.java

Ooops, you will get this (wrong) compiler error message:
  Sub.java:4: incompatible types
  found   : Base.Inner<java.lang.String>
  required: Base.Inner<java.lang.String>
          private Inner<String> innerStr = constructInnerOfString("");
                                                                 ^
  1 error

The problem seem to occur every time, you assign it to a variable.
If you assign the variable 'innerStr' in a constructor, you will get it,
too.
If you just call the method constructInnerOfString(...), you will get it
not.

Is this compiler bug known?
Or is it a new one?
Does anybody know anything about it?

Greetings

    Reinhard Bellmann
Thomas Hawtin - 23 Dec 2005 10:57 GMT
> Is this compiler bug known?
> Or is it a new one?
> Does anybody know anything about it?

Have you searched bugs.sun.com?

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

Reinhard B. - 23 Dec 2005 21:43 GMT
Hello!

Thomas Hawtin schrieb:
> Have you searched bugs.sun.com?

Now I did.   :-)

It seems to be this one:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6343995

Thanx!

    Reinhard

Signature

Reinhard Bellmann

hiwa - 24 Dec 2005 00:33 GMT
JDK 1.6 (build 61) does not have this bug.
Thomas Hawtin - 24 Dec 2005 09:00 GMT
> JDK 1.6 (build 61) does not have this bug.

Really? 1.6.0-rc-b63 does.

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.