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

Discussion in 'Java' started by HK, Jul 18, 2005.

  1. HK

    HK Guest

    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.
     
    HK, Jul 18, 2005
    #1
    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. =?Utf-8?B?VGF5bG9yIEguIE1heHdlbGw=?=

    Attempted EventLog Trace triggers error

    =?Utf-8?B?VGF5bG9yIEguIE1heHdlbGw=?=, Jun 3, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    407
    =?Utf-8?B?VGF5bG9yIEguIE1heHdlbGw=?=
    Jun 3, 2005
  2. baibaichen

    trivial or non-trivial object

    baibaichen, Jan 12, 2006, in forum: C++
    Replies:
    3
    Views:
    939
    osmium
    Jan 12, 2006
  3. Nagaraj
    Replies:
    1
    Views:
    900
    Lionel B
    Mar 1, 2007
  4. timjowers
    Replies:
    7
    Views:
    4,394
    heyjude
    Feb 2, 2011
  5. Rahul Kumar
    Replies:
    1
    Views:
    110
    ara.t.howard
    Sep 13, 2010
Loading...

Share This Page