Lines 19-30
Link Here
|
19 |
import org.eclipse.core.runtime.IStatus; |
19 |
import org.eclipse.core.runtime.IStatus; |
20 |
import org.eclipse.core.runtime.Status; |
20 |
import org.eclipse.core.runtime.Status; |
21 |
import org.eclipse.jdt.core.compiler.*; |
21 |
import org.eclipse.jdt.core.compiler.*; |
22 |
import org.eclipse.jdt.core.compiler.InvalidInputException; |
22 |
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; |
23 |
import org.eclipse.jdt.internal.compiler.parser.Scanner; |
23 |
import org.eclipse.jdt.internal.compiler.parser.Scanner; |
24 |
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; |
24 |
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; |
25 |
import org.eclipse.jdt.internal.compiler.util.SuffixConstants; |
25 |
import org.eclipse.jdt.internal.compiler.util.SuffixConstants; |
26 |
import org.eclipse.jdt.internal.core.*; |
26 |
import org.eclipse.jdt.internal.core.*; |
27 |
import org.eclipse.jdt.internal.core.JavaModelStatus; |
|
|
28 |
import org.eclipse.jdt.internal.core.util.Messages; |
27 |
import org.eclipse.jdt.internal.core.util.Messages; |
29 |
|
28 |
|
30 |
/** |
29 |
/** |
Lines 37-42
Link Here
|
37 |
public final class JavaConventions { |
36 |
public final class JavaConventions { |
38 |
|
37 |
|
39 |
private final static char DOT= '.'; |
38 |
private final static char DOT= '.'; |
|
|
39 |
private static final String PACKAGE_INFO = new String(TypeConstants.PACKAGE_INFO_NAME); |
40 |
private final static Scanner SCANNER = new Scanner(); |
40 |
private final static Scanner SCANNER = new Scanner(); |
41 |
|
41 |
|
42 |
private JavaConventions() { |
42 |
private JavaConventions() { |
Lines 140-146
Link Here
|
140 |
// JSR-175 metadata strongly recommends "package-info.java" as the |
140 |
// JSR-175 metadata strongly recommends "package-info.java" as the |
141 |
// file in which to store package annotations and |
141 |
// file in which to store package annotations and |
142 |
// the package-level spec (replaces package.html) |
142 |
// the package-level spec (replaces package.html) |
143 |
if (!identifier.equals("package-info")) { //$NON-NLS-1$ |
143 |
if (!identifier.equals(PACKAGE_INFO)) { |
144 |
IStatus status = validateIdentifier(identifier); |
144 |
IStatus status = validateIdentifier(identifier); |
145 |
if (!status.isOK()) { |
145 |
if (!status.isOK()) { |
146 |
return status; |
146 |
return status; |
Lines 183-193
Link Here
|
183 |
return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Messages.convention_classFile_notClassFileName, null); |
183 |
return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Messages.convention_classFile_notClassFileName, null); |
184 |
} |
184 |
} |
185 |
identifier = name.substring(0, index); |
185 |
identifier = name.substring(0, index); |
186 |
IStatus status = validateIdentifier(identifier); |
186 |
// JSR-175 metadata strongly recommends "package-info.java" as the |
187 |
if (!status.isOK()) { |
187 |
// file in which to store package annotations and |
188 |
return status; |
188 |
// the package-level spec (replaces package.html) |
|
|
189 |
if (!identifier.equals(PACKAGE_INFO)) { |
190 |
IStatus status = validateIdentifier(identifier); |
191 |
if (!status.isOK()) { |
192 |
return status; |
193 |
} |
189 |
} |
194 |
} |
190 |
status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE); |
195 |
IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE); |
191 |
if (!status.isOK()) { |
196 |
if (!status.isOK()) { |
192 |
return status; |
197 |
return status; |
193 |
} |
198 |
} |