Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Adding type parameter to trivial class triggers compile error in java 1.5

Reply
Thread Tools

Adding type parameter to trivial class triggers compile error in java 1.5

 
 
HK
Guest
Posts: n/a
 
      07-18-2005
First I compile this without error with javac from 1.5.0_04

public class Bla {
public static final int x = Bli.innerX;
private class Bli {
public static final int innerX = 1;
}
}

Then I add an unused type parameter:

public class Bla<T> {
public static final int x = Bli.innerX;
private class Bli {
public static final int innerX = 1;
}
}

and the compilation results in this error:

% ./jdk1.5/bin/javac -source 1.5 Bla.java
Bla.java:4: non-static class Bla.Bli cannot be referenced from a static
context
public static final int x = Bli.innerX;
^
1 error

Is this a bug or a feature?

Harald.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compile directive for conditional compile for Java 1.4 versus Java 5 timjowers Java 7 02-02-2011 12:08 AM
creating trivial classes with Struct.new (adding constraints Rahul Kumar Ruby 1 09-13-2010 03:34 AM
cant compile on linux system.cant compile on cant compile onlinux system. Nagaraj C++ 1 03-01-2007 11:18 AM
Adding MonitorMixin causes compile failure when initialize takes a parameter Scott Ruby 2 08-10-2006 03:14 PM
trivial or non-trivial object baibaichen C++ 3 01-12-2006 03:01 PM



Advertisments