Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK7 Compile Issues #26

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 3 comments
Closed

JDK7 Compile Issues #26

GoogleCodeExporter opened this issue Mar 19, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

Compiling with JDK7 results in errors.

$ ant
Buildfile: build.xml

compile:
    [mkdir] Created dir: /home/xxx/src/sfntly/java/build/classes
    [javac] Compiling 104 source files to /home/xxx/src/sfntly/java/build/classes
    [javac] /home/xxx/src/sfntly/java/src/com/google/typography/font/sfntly/table/Table.java:169: error: header has private access in Table
    [javac]         table.header = header;
    [javac]              ^
    [javac] 1 error

Original issue reported on code.google.com by stua...@google.com on 6 Nov 2012 at 9:31

@GoogleCodeExporter
Copy link
Author

Original comment by stua...@google.com on 6 Nov 2012 at 9:31

@GoogleCodeExporter
Copy link
Author

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 stua...@google.com on 17 Jan 2013 at 7:45

@GoogleCodeExporter
Copy link
Author

Fixed with r149

Original comment by stua...@google.com on 17 Jan 2013 at 7:47

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant