Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » ECJ Java 7 access private of generic
ECJ Java 7 access private of generic [message #1017012] Fri, 08 March 2013 15:38
Paul Bilnoski is currently offline Paul BilnoskiFriend
Messages: 28
Registered: August 2010
Junior Member
Migrating some projects from java 6 compliance to java 7, I discovered (something like) this which does not compile under 7 but did under 6:

class X
   private String m()
      return null;
   public <T extends X> void f(T t)
      t.m(); // "The method m() from the type X is not visible" in Java 7 compliance

Private methods and fields are not accessible to a local method if the type is a bounded generic type where the bound is the type itself.

Should access to private methods and fields be allowed in this case? Is it a bug in the Java 7 compiler, a bug fix, or adherence to an improvement in the JLS for Java 7?

My code does not depend on this being private (I can change it to package-private or protected), I am just trying to gather more information about the issue.
Previous Topic:Freezing while loading project over Network
Next Topic:No suitable driver found for 'ojdbc6.jar'
Goto Forum:

Current Time: Mon May 21 22:58:06 GMT 2018

Powered by FUDForum. Page generated in 0.01893 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top