Coder Social home page Coder Social logo

JDK7 Compile Issues about sfntly HOT 3 CLOSED

lilee avatar lilee commented on July 22, 2024
JDK7 Compile Issues

from sfntly.

Comments (3)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024

Original comment by [email protected] on 6 Nov 2012 at 9:31

from sfntly.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
Issue is because of a change in the javac tool between Java 6 and 7.

http://www.oracle.com/technetwork/java/javase/compatibility-417013.html#behavior
al

Area: Tools
Synopsis: Compiler No Longer Allows Access to Private Members of Type Variables
Description: In JDK 5.0 and JDK 6, javac erroneously allowed access to private 
members of type-variables. This is wrong, as the JLS, Java SE 7 Edition, 
section 4.4, states that the members of a type-variable are the members of an 
intersection types whose components are the type-variable bounds (intersection 
types are defined in section 4.9) - and intersection types do not inherit 
private members from their components. As a result, the following program 
should get a compilation error:
class A {
   private int val = 42;
}

class Test<X extends A> {
    void test(X x) {
    int i = x.val; //error in JDK 7
    }
}
The above program compiles in JDK 6. Note that accepting this program is 
inherently unsound; there is no guarantee that X will be instantiated to a type 
that inherits val. For instance, if we called test() on an instance whose type 
is Test<B>, where B is a subclass of A, val should not be accessible there. 
Since javac cannot guarantee the well-formedness of this program for all 
possible instantiations of X this program must be rejected.
Nature of Incompatibility: behavioral and source
RFE: 6246814

Original comment by [email protected] on 17 Jan 2013 at 7:45

from sfntly.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 22, 2024
Fixed with r149

Original comment by [email protected] on 17 Jan 2013 at 7:47

  • Changed state: Fixed

from sfntly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.