Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Controlling access of packages(Change the visibility od packages)
Controlling access of packages [message #1130228] Wed, 09 October 2013 10:37
Pierrick MARIE is currently offline Pierrick MARIEFriend
Messages: 1
Registered: October 2013
Junior Member
Hi,

With the Eclipse Java editor it is possible to change the visibility of declared packages like this :

private package com.mypackage

class Foo {
 // say hello
}


With Eclipse, this piece of code is executed normally with no problem. Whatever the keyword before the package declaration (private, protected or public) the compilation and the execution produce the same result.

But, as it is specified by Java, it is impossible to change the visibility of packages, see : docs.oracle.com/javase/specs/jls/se7/html/jls-7.html#jls-7.4
If I compile manually this code I have an error :

$ javac com.mypackage.Foo

Foo.java:1: error: class, interface, or enum expected
private package com.monsuperpackage;
       ^
1 error


I don't understand why it is possible to change the visibility of packages with the Eclipse Java editor (and only with it). What is the feature ?

ps : I use the version 1.7.0_25 of javac.

Thank you.
Previous Topic:Whats going wrong?
Next Topic:Is the Workbench guaranteed to be available when a plugin with dependency on org.eclipse.ui starts?
Goto Forum:
  


Current Time: Fri Mar 29 07:51:10 GMT 2024

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

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

Back to the top