*** empty log message ***
diff --git a/.classpath b/.classpath index e1df1e3..51c65a5 100644 --- a/.classpath +++ b/.classpath
@@ -6,7 +6,6 @@ <classpathentry kind="lib" path="/org.eclipse.core.runtime/runtime.jar" sourcepath="/org.eclipse.core.runtime/runtimesrc.zip"/> <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/> - <classpathentry kind="src" path="Eclipse Java Ant Compiler"/> <classpathentry kind="src" path="Eclipse Java Batch Compiler"/> <classpathentry kind="src" path="Eclipse Java Code Assist"/> <classpathentry kind="src" path="Eclipse Java Compiler"/> @@ -14,8 +13,5 @@ <classpathentry kind="src" path="Eclipse Java Evaluation"/> <classpathentry kind="src" path="Eclipse Java Model"/> <classpathentry kind="src" path="Eclipse Java Formatter"/> - <classpathentry kind="lib" path="/org.eclipse.ant.core/ant.jar"/> - <classpathentry kind="lib" - path="/org.eclipse.ant.core/antsupport.jar" sourcepath="/org.eclipse.ant.core/antsupportsrc.zip"/> <classpathentry kind="output" path="bin"/> </classpath>
diff --git a/.vcm_meta b/.vcm_meta index aae2e1b..7655f8d 100644 --- a/.vcm_meta +++ b/.vcm_meta
@@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project-description> + <comment></comment> <nature id="org.eclipse.jdt.core.javanature"/> <builder name="org.eclipse.jdt.core.javabuilder"> </builder>
diff --git a/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java b/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java index 6d1e55c..8a449a5 100644 --- a/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java +++ b/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java
@@ -75,6 +75,6 @@ return new NameEnvironmentAnswer(new CompilationUnit(null, fullName)); } public String toString() { - return "ClasspathDirectory "/*nonNLS*/ + path; + return "ClasspathDirectory " + path; } }
diff --git a/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java b/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java index 5bdafd4..b64fa0e 100644 --- a/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java +++ b/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java
@@ -80,6 +80,6 @@ } } public String toString() { - return "Classpath for jar file "/*nonNLS*/ + zipFile; + return "Classpath for jar file " + zipFile; } }
diff --git a/batch/org/eclipse/jdt/internal/compiler/batch/CompilationUnit.java b/batch/org/eclipse/jdt/internal/compiler/batch/CompilationUnit.java index bf7d5f5..816aab0 100644 --- a/batch/org/eclipse/jdt/internal/compiler/batch/CompilationUnit.java +++ b/batch/org/eclipse/jdt/internal/compiler/batch/CompilationUnit.java
@@ -16,11 +16,11 @@ this.contents = contents; this.fileName = fileName.toCharArray(); - int start = fileName.lastIndexOf("/"/*nonNLS*/) + 1; - if (start == 0 || start < fileName.lastIndexOf("\\"/*nonNLS*/)) - start = fileName.lastIndexOf("\\"/*nonNLS*/) + 1; + int start = fileName.lastIndexOf("/") + 1; + if (start == 0 || start < fileName.lastIndexOf("\\")) + start = fileName.lastIndexOf("\\") + 1; - int end = fileName.lastIndexOf("."/*nonNLS*/); + int end = fileName.lastIndexOf("."); if (end == -1) end = fileName.length(); @@ -70,6 +70,6 @@ return mainTypeName; } public String toString() { - return "CompilationUnit["/*nonNLS*/ + new String(fileName) + "]"/*nonNLS*/; + return "CompilationUnit[" + new String(fileName) + "]"; } }
diff --git a/batch/org/eclipse/jdt/internal/compiler/batch/FileFinder.java b/batch/org/eclipse/jdt/internal/compiler/batch/FileFinder.java index b187763..b8d7633 100644 --- a/batch/org/eclipse/jdt/internal/compiler/batch/FileFinder.java +++ b/batch/org/eclipse/jdt/internal/compiler/batch/FileFinder.java
@@ -12,13 +12,13 @@ public int counter = 0; public void find(File f, String pattern, boolean verbose) { if (verbose) { - System.out.println(Main.bind("scanning.start"/*nonNLS*/,f.getAbsolutePath())); + System.out.println("Scanning of " + f.getAbsolutePath()); } find0(f, pattern, verbose); System.arraycopy(resultFiles, 0, (resultFiles = new String[counter]), 0, counter); if (verbose) { System.out.println(); - System.out.println(Main.bind("scanning.done"/*nonNLS*/,f.getAbsolutePath())); + System.out.println("Scanning of " + f.getAbsolutePath() + " DONE"); } } public void find0(File f, String pattern, boolean verbose) {
diff --git a/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java b/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java index 265ca32..25129fa 100644 --- a/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java +++ b/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java
@@ -37,7 +37,7 @@ if (file.isDirectory()) { classpaths[i] = new ClasspathDirectory(file); pathNames[i] = ((ClasspathDirectory) classpaths[i]).path; - } else if (classpathNames[i].endsWith(".jar"/*nonNLS*/) | (classpathNames[i].endsWith(".zip"/*nonNLS*/))) { + } else if (classpathNames[i].endsWith(".jar") | (classpathNames[i].endsWith(".zip"))) { classpaths[i] = new ClasspathJar(file); pathNames[i] = classpathNames[i].substring(0, classpathNames[i].lastIndexOf('.')); } @@ -65,7 +65,7 @@ for (int i = initialFileNames.length; --i >= 0;) { String fileName = initialFileNames[i]; String matchingPathName = null; - if (fileName.lastIndexOf("."/*nonNLS*/) != -1) + if (fileName.lastIndexOf(".") != -1) fileName = fileName.substring(0, fileName.lastIndexOf('.')); // remove trailing ".java" fileName = convertPathSeparators(fileName); @@ -101,8 +101,8 @@ return null; // looking for a file which we know was provided at the beginning of the compilation String filename = new String(name); - String binaryFilename = filename + ".class"/*nonNLS*/; - String sourceFilename = filename + ".java"/*nonNLS*/; + String binaryFilename = filename + ".class"; + String sourceFilename = filename + ".java"; for (int i = 0, length = classpaths.length; i < length; i++) { Classpath classpath = classpaths[i]; boolean binaryExists = classpath.exists(binaryFilename, packageName);
diff --git a/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/batch/org/eclipse/jdt/internal/compiler/batch/Main.java index 0105201..a7da415 100644 --- a/batch/org/eclipse/jdt/internal/compiler/batch/Main.java +++ b/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
@@ -51,27 +51,10 @@ int globalErrorsCount; int globalWarningsCount; - String versionID = "0.125.12 (jck1.3a)"/*nonNLS*/; - private static final char[] CLASS_FILE_EXTENSION = ".class"/*nonNLS*/.toCharArray(); + String versionID = "0.103"; + private static final char[] CLASS_FILE_EXTENSION = ".class".toCharArray(); int exportedClassFilesCounter; - - /** - * Are we running JDK 1.1? - */ - private static boolean JDK1_1 = false; - - /* Bundle containing messages */ - protected static ResourceBundle bundle; - private final static String bundleName = "org.eclipse.jdt.internal.compiler.batch.Messages"/*nonNLS*/; - static { - String ver = System.getProperty("java.version"/*nonNLS*/); - JDK1_1 = ((ver != null) && ver.startsWith("1.1"/*nonNLS*/)); - relocalize(); - } - - private boolean proceed = true; - protected Main(PrintWriter writer, boolean systemExitWhenFinished) { this.out = writer; this.systemExitWhenFinished = systemExitWhenFinished; @@ -84,73 +67,69 @@ // decode command line arguments try { configure(argv); - if(proceed){ - if (showProgress) out.print(Main.bind("progress.compiling"/*nonNLS*/)); - for (int i = 0; i < repetitions; i++){ - globalProblemsCount = 0; - globalErrorsCount = 0; - globalWarningsCount = 0; - lineCount = 0; - - if (repetitions > 1){ - out.flush(); - out.println(Main.bind("compile.repetition"/*nonNLS*/,String.valueOf(i+1),String.valueOf(repetitions))); - } - long startTime = System.currentTimeMillis(); - // request compilation - performCompilation(); - if (timer) { - - time = System.currentTimeMillis() - startTime; - if (lineCount != 0){ - out.println(Main.bind("compile.instantTime"/*nonNLS*/,new String[]{String.valueOf(lineCount),String.valueOf(time),String.valueOf((((int)((lineCount*10000.0)/time))/10.0))})); - } else { - out.println(Main.bind("compile.totalTime"/*nonNLS*/,String.valueOf(time))); - } - } - if (globalProblemsCount > 0) { - if (globalProblemsCount == 1) { - out.print(Main.bind("compile.oneProblem"/*nonNLS*/)); - } else { - out.print(Main.bind("compile.severalProblems"/*nonNLS*/,String.valueOf(globalProblemsCount))); - } - out.print(" ("/*nonNLS*/); - if (globalErrorsCount > 0) { - if (globalErrorsCount == 1) { - out.print(Main.bind("compile.oneError"/*nonNLS*/)); - } else { - out.print(Main.bind("compile.severalErrors"/*nonNLS*/,String.valueOf(globalErrorsCount))); - } - } - if (globalWarningsCount > 0) { - if (globalErrorsCount > 0) { - out.print(", "/*nonNLS*/); - } - if (globalWarningsCount == 1) { - out.print(Main.bind("compile.oneWarning"/*nonNLS*/)); - } else { - out.print(Main.bind("compile.severalWarnings"/*nonNLS*/,String.valueOf(globalWarningsCount))); - } - } - out.println(")"/*nonNLS*/); - } - if (exportedClassFilesCounter != 0 && (this.showProgress || this.timer || this.verbose)) { - if (exportedClassFilesCounter == 1) { - out.print(Main.bind("compile.oneClassFileGenerated"/*nonNLS*/)); - } else { - out.print(Main.bind("compile.severalClassFilesGenerated"/*nonNLS*/,String.valueOf(exportedClassFilesCounter))); - } + if (showProgress) System.out.print("Compiling"); + for (int i = 0; i < repetitions; i++){ + globalProblemsCount = 0; + globalErrorsCount = 0; + globalWarningsCount = 0; + lineCount = 0; + if (repetitions > 1){ + out.flush(); + out.println("Repetition "+(i+1)+"/"+repetitions); + } + long startTime = System.currentTimeMillis(); + + // request compilation + performCompilation(); + if (timer) { + time = System.currentTimeMillis() - startTime; + if (lineCount != 0){ + out.println("Compiled " + lineCount + " lines in "+ time + " ms ("+ (((int)((lineCount*10000.0)/time))/10.0) + " lines/s)"); + } else { + out.println("Total compilation time: " + time); } } - if (showProgress) System.out.println(); + if (globalProblemsCount > 0) { + if (globalProblemsCount == 1) { + out.print("1 problem ("); + } else { + out.print(globalProblemsCount + " problems ("); + } + if (globalErrorsCount > 0) { + if (globalErrorsCount == 1) { + out.print("1 error"); + } else { + out.print(globalErrorsCount + " errors"); + } + } + if (globalWarningsCount > 0) { + if (globalErrorsCount > 0) { + out.print(", "); + } + if (globalWarningsCount == 1) { + out.print("1 warning"); + } else { + out.print(globalWarningsCount + " warnings"); + } + } + out.println(")"); + } + if (exportedClassFilesCounter != 0 && (this.showProgress || this.timer || this.verbose)) { + if (exportedClassFilesCounter == 1) { + out.println("1 .class file generated"); + } else { + out.println(exportedClassFilesCounter + " .class files generated"); + } + } } + if (showProgress) System.out.println(); if (systemExitWhenFinished){ out.flush(); System.exit(globalErrorsCount > 0 ? -1 : 0); } } catch (InvalidInputException e) { out.println(e.getMessage()); - out.println("------------------------"/*nonNLS*/); + out.println("------------------------"); printUsage(); if (systemExitWhenFinished){ System.exit(-1); @@ -200,7 +179,7 @@ argv[count-1] += File.pathSeparator; insideClasspath = true; } else { - tokenizer = new StringTokenizer(subCommandLine, File.pathSeparator + " "/*nonNLS*/); + tokenizer = new StringTokenizer(subCommandLine, File.pathSeparator + " "); while (tokenizer.hasMoreTokens()) { if (count == argv.length) { System.arraycopy(argv, 0, (argv = new String[count * 2]), 0, count); @@ -229,7 +208,7 @@ } argv[count++] = commandLine.substring(startIndex, commandLine.length()); } else { - tokenizer = new StringTokenizer(commandLine.substring(startIndex, commandLine.length()), File.pathSeparator + " "/*nonNLS*/); + tokenizer = new StringTokenizer(commandLine.substring(startIndex, commandLine.length()), File.pathSeparator + " "); while (tokenizer.hasMoreTokens()) { if (count == argv.length) { System.arraycopy(argv, 0, (argv = new String[count * 2]), 0, count); @@ -247,7 +226,7 @@ */ private void configure(String[] argv) throws InvalidInputException { if ((argv == null) || (argv.length == 0)) - throw new InvalidInputException(Main.bind("configure.noSourceFile"/*nonNLS*/)); + throw new InvalidInputException("no source file specified"); final int InsideClasspath = 1; final int InsideDestinationPath = 2; final int TargetSetting = 4; @@ -266,7 +245,7 @@ while (++index < argCount) { String currentArg = argv[index].trim(); - if (currentArg.endsWith(".java"/*nonNLS*/)) { + if (currentArg.endsWith(".java")) { if (filenames == null) { filenames = new String[argCount - index]; } else if (filesCount == filenames.length) { @@ -277,75 +256,75 @@ mode = Default; continue; } - if (currentArg.equals("-log"/*nonNLS*/)) { + if (currentArg.equals("-log")) { if (log != null) - throw new InvalidInputException(Main.bind("configure.duplicateLog"/*nonNLS*/,currentArg)); + throw new InvalidInputException("duplicate log specification: " + currentArg); mode = InsideLog; continue; } - if (currentArg.equals("-repeat"/*nonNLS*/)) { + if (currentArg.equals("-repeat")) { if (repetitions > 0) - throw new InvalidInputException(Main.bind("configure.duplicateRepeat"/*nonNLS*/,currentArg)); + throw new InvalidInputException("duplicate repeat specification: " + currentArg); mode = InsideRepetition; continue; } - if (currentArg.equals("-d"/*nonNLS*/)) { + if (currentArg.equals("-d")) { if (destinationPath != null) - throw new InvalidInputException(Main.bind("configure.duplicateOutputPath"/*nonNLS*/,currentArg)); + throw new InvalidInputException("duplicate output path specification: " + currentArg); mode = InsideDestinationPath; continue; } - if (currentArg.equals("-classpath"/*nonNLS*/)) { + if (currentArg.equals("-classpath")) { if (pathCount > 0) - throw new InvalidInputException(Main.bind("configure.duplicateClasspath"/*nonNLS*/,currentArg)); + throw new InvalidInputException("duplicate classpath specification: " + currentArg); classpaths = new String[DEFAULT_SIZE_CLASSPATH]; mode = InsideClasspath; continue; } - if (currentArg.equals("-progress"/*nonNLS*/)) { + if (currentArg.equals("-progress")) { mode = Default; showProgress = true; continue; } - if (currentArg.equals("-proceedOnError"/*nonNLS*/)) { + if (currentArg.equals("-proceedOnError")) { mode = Default; proceedOnError = true; continue; } - if (currentArg.equals("-time"/*nonNLS*/)) { + if (currentArg.equals("-time")) { mode = Default; timer = true; continue; } - if (currentArg.equals("-version"/*nonNLS*/) || currentArg.equals("-v"/*nonNLS*/)) { + if (currentArg.equals("-version") || currentArg.equals("-v")) { versionIDRequired = true; continue; } - if (currentArg.equals("-help"/*nonNLS*/)) { + if (currentArg.equals("-help")) { printUsageRequired = true; continue; } - if (currentArg.equals("-noImportError"/*nonNLS*/)) { + if (currentArg.equals("-noImportError")) { mode = Default; importProblemIsError = false; continue; } - if (currentArg.equals("-noExit"/*nonNLS*/)) { + if (currentArg.equals("-noExit")) { mode = Default; systemExitWhenFinished = false; continue; } - if (currentArg.equals("-verbose"/*nonNLS*/)) { + if (currentArg.equals("-verbose")) { mode = Default; verbose = true; continue; } - if (currentArg.equals("-referenceInfo"/*nonNLS*/)) { + if (currentArg.equals("-referenceInfo")) { mode = Default; produceRefInfo = true; continue; } - if (currentArg.startsWith("-g"/*nonNLS*/)) { + if (currentArg.startsWith("-g")) { mode = Default; debugMask = 0; // reinitialize the default value String debugOption = currentArg; @@ -355,91 +334,89 @@ continue; } if (length > 3) { - if (length == 7 && debugOption.equals("-g:none"/*nonNLS*/)) + if (length == 7 && debugOption.equals("-g:none")) continue; - StringTokenizer tokenizer = new StringTokenizer(debugOption.substring(3, debugOption.length()), ","/*nonNLS*/); + StringTokenizer tokenizer = new StringTokenizer(debugOption.substring(3, debugOption.length()), ","); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); - if (token.equals("vars"/*nonNLS*/)) { + if (token.equals("vars")) { debugMask |= CompilerOptions.Vars; - } else if (token.equals("lines"/*nonNLS*/)) { + } else if (token.equals("lines")) { debugMask |= CompilerOptions.Lines; - } else if (token.equals("source"/*nonNLS*/)) { + } else if (token.equals("source")) { debugMask |= CompilerOptions.Source; } else { - throw new InvalidInputException(Main.bind("configure.invalidDebugOption"/*nonNLS*/,debugOption)); + throw new InvalidInputException("invalid debug option: " + debugOption); } } continue; } - throw new InvalidInputException(Main.bind("configure.invalidDebugOption"/*nonNLS*/,debugOption)); + throw new InvalidInputException("invalid debug option: " + debugOption); } - if (currentArg.startsWith("-nowarn"/*nonNLS*/)) { + if (currentArg.startsWith("-nowarn")) { noWarnOptionInUsed = true; if (warnOptionInUsed) - throw new InvalidInputException(Main.bind("configure.duplicateWarningConfiguration"/*nonNLS*/)); + throw new InvalidInputException("duplicate usage of warning configuration"); mode = Default; warningMask = TemporaryWarning; // reinitialize the default value (still see TemporaryWarning) continue; } - if (currentArg.startsWith("-warn"/*nonNLS*/)) { + if (currentArg.startsWith("-warn")) { warnOptionInUsed = true; if (noWarnOptionInUsed) - throw new InvalidInputException(Main.bind("configure.duplicateWarningConfiguration"/*nonNLS*/)); + throw new InvalidInputException("duplicate usage of warning configuration"); mode = Default; String warningOption = currentArg; int length = currentArg.length(); - if (length == 10 && warningOption.equals("-warn:none"/*nonNLS*/)) { + if (length == 10 && warningOption.equals("-warn:none")) { warningMask = TemporaryWarning; // reinitialize the default value (still see TemporaryWarning) continue; } if (length < 6) - throw new InvalidInputException(Main.bind("configure.invalidWarningConfiguration"/*nonNLS*/,warningOption)); - StringTokenizer tokenizer = new StringTokenizer(warningOption.substring(6, warningOption.length()), ","/*nonNLS*/); + throw new InvalidInputException("invalid warning configuration: " + warningOption); + StringTokenizer tokenizer = new StringTokenizer(warningOption.substring(6, warningOption.length()), ","); int tokenCounter = 0; warningMask = 0; // reinitialize the default value while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); tokenCounter++; - if (token.equals("constructorName"/*nonNLS*/)) { + if (token.equals("constructorName")) { warningMask |= CompilerOptions.MethodWithConstructorName; - } else if (token.equals("packageDefaultMethod"/*nonNLS*/)) { + } else if (token.equals("packageDefaultMethod")) { warningMask |= CompilerOptions.OverriddenPackageDefaultMethod; - } else if (token.equals("maskedCatchBlocks"/*nonNLS*/)) { + } else if (token.equals("maskedCatchBlocks")) { warningMask |= CompilerOptions.MaskedCatchBlock; - } else if (token.equals("deprecation"/*nonNLS*/)) { + } else if (token.equals("deprecation")) { warningMask |= CompilerOptions.UsingDeprecatedAPI; - } else if (token.equals("unusedLocals"/*nonNLS*/)) { + } else if (token.equals("unusedLocals")) { warningMask |= CompilerOptions.UnusedLocalVariable; - } else if (token.equals("unusedArguments"/*nonNLS*/)) { + } else if (token.equals("unusedArguments")) { warningMask |= CompilerOptions.UnusedArgument; - } else if (token.equals("syntheticAccess"/*nonNLS*/)){ + } else if (token.equals("syntheticAccess")){ warningMask |= CompilerOptions.AccessEmulation; - } else if (token.equals("nls"/*nonNLS*/)){ - warningMask |= CompilerOptions.NonExternalizedString; } else { - throw new InvalidInputException(Main.bind("configure.invalidWarning"/*nonNLS*/,token)); + throw new InvalidInputException("invalid warning: " + token); } } if (tokenCounter == 0) - throw new InvalidInputException(Main.bind("configure.invalidWarningOption"/*nonNLS*/,currentArg)); + throw new InvalidInputException("invalid warning option: " + currentArg); continue; } - if (currentArg.equals("-target"/*nonNLS*/)) { + if (currentArg.equals("-target")) { mode = TargetSetting; continue; } - if (currentArg.equals("-preserveAllLocals"/*nonNLS*/)) { + if (currentArg.equals("-preserveAllLocals")) { preserveAllLocalVariables = true; continue; } if (mode == TargetSetting) { - if (currentArg.equals("1.1"/*nonNLS*/)) { + if (currentArg.equals("1.1")) { targetJDK = CompilerOptions.JDK1_1; - } else if (currentArg.equals("1.2"/*nonNLS*/)) { + } else if (currentArg.equals("1.2")) { targetJDK = CompilerOptions.JDK1_2; } else { - throw new InvalidInputException(Main.bind("configure.targetJDK"/*nonNLS*/,currentArg)); + throw new InvalidInputException("target JDK is either '1.1' or '1.2': " + currentArg); } mode = Default; continue; @@ -453,10 +430,10 @@ try { repetitions = Integer.parseInt(currentArg); if (repetitions <= 0){ - throw new InvalidInputException(Main.bind("configure.repetition"/*nonNLS*/,currentArg)); + throw new InvalidInputException("repetition must be a positive integer: " + currentArg); } } catch(NumberFormatException e){ - throw new InvalidInputException(Main.bind("configure.repetition"/*nonNLS*/,currentArg)); + throw new InvalidInputException("repetition must be a positive integer: " + currentArg); } mode = Default; continue; @@ -484,12 +461,12 @@ currentArg = currentArg.substring(0, currentArg.length() - File.separator.length()); File dir = new File(currentArg); if (!dir.isDirectory()) - throw new InvalidInputException(Main.bind("configure.directoryNotExist"/*nonNLS*/,currentArg)); + throw new InvalidInputException("directory does not exist: " + currentArg); FileFinder finder = new FileFinder(); try{ - finder.find(dir, ".JAVA"/*nonNLS*/, verbose); + finder.find(dir, ".JAVA", verbose); } catch(Exception e){ - throw new InvalidInputException(Main.bind("configure.IOError"/*nonNLS*/,currentArg)); + throw new InvalidInputException("i/o error : unable to retrieve .JAVA files in directory: " + currentArg); } if (filenames != null) { // some source files were specified explicitly @@ -510,25 +487,22 @@ * Standalone options */ if (versionIDRequired) { - out.println(Main.bind("configure.version"/*nonNLS*/,this.versionID)); - out.println(); - proceed = false; + out.println("Eclipse Java Compiler "+ this.versionID + ", Copyright IBM Corp 2000\n"); return; } if (printUsageRequired) { printUsage(); - proceed = false; return; } if (filesCount != 0) System.arraycopy(filenames, 0, (filenames = new String[filesCount]), 0, filesCount); if (pathCount == 0) { - String classProp = System.getProperty("LFclasspath"/*nonNLS*/); + String classProp = System.getProperty("LFclasspath"); if ((classProp == null) || (classProp.length() == 0)) { - out.println(Main.bind("configure.noClasspath"/*nonNLS*/)); - classProp = "."/*nonNLS*/; + out.println("no classpath defined (LF_CLASSPATH), using default directory instead"); + classProp = "."; } StringTokenizer tokenizer = new StringTokenizer(classProp, File.pathSeparator); classpaths = new String[tokenizer.countTokens()]; @@ -543,27 +517,26 @@ for (int i = 0, max = classpaths.length; i < max; i++) { File file = new File(classpaths[i]); if (!file.exists()) - throw new InvalidInputException(Main.bind("configure.incorrectClasspath"/*nonNLS*/,classpaths[i])); + throw new InvalidInputException("incorrect classpath: " + classpaths[i]); } if (destinationPath == null) { - destinationPath = System.getProperty("user.dir"/*nonNLS*/); - } else if ("none"/*nonNLS*/.equals(destinationPath)) { + destinationPath = System.getProperty("user.dir"); + } else if ("none".equals(destinationPath)) { destinationPath = null; } if (filenames == null) - throw new InvalidInputException(Main.bind("configure.noSource"/*nonNLS*/)); + throw new InvalidInputException("no source file specified"); if (log != null){ try { out = new PrintWriter(new FileOutputStream(log, false)); } catch(IOException e){ - throw new InvalidInputException(Main.bind("configure.cannotOpenLog"/*nonNLS*/)); + throw new InvalidInputException("cannot open .log file"); } } else { showProgress = false; } - if (repetitions == 0) { repetitions = 1; } @@ -592,22 +565,21 @@ if (problems[i] != null) { globalProblemsCount++; if (localErrorCount == 0) - out.println("----------"/*nonNLS*/); - out.print(globalProblemsCount + ". "/*nonNLS*/ + (problems[i].isError() ? Main.bind("requestor.error"/*nonNLS*/) : Main.bind("requestor.warning"/*nonNLS*/))); + out.println("----------"); + out.print(globalProblemsCount + (problems[i].isError() ? ". ERROR" : ". WARNING")); if (problems[i].isError()) { globalErrorsCount++; } else { globalWarningsCount++; } - out.print(" "/*nonNLS*/); - out.print(Main.bind("requestor.in"/*nonNLS*/,new String(problems[i].getOriginatingFileName()))); + out.print(" in " + new String(problems[i].getOriginatingFileName())); try { out.println(((DefaultProblem)problems[i]).errorReportSource(compilationResult.compilationUnit)); out.println(problems[i].getMessage()); } catch (Exception e) { - out.println(Main.bind("requestor.notRetrieveErrorMessage"/*nonNLS*/,problems[i].toString())); + out.println("Cannot retrieve the error message for " + problems[i].toString()); } - out.println("----------"/*nonNLS*/); + out.println("----------"); if (problems[i].isError()) localErrorCount++; } @@ -628,18 +600,19 @@ protected CompilationUnit[] getCompilationUnits() throws InvalidInputException { int fileCount = filenames.length; CompilationUnit[] units = new CompilationUnit[fileCount]; + HashtableOfObject knownFileNames = new HashtableOfObject(fileCount); for (int i = 0; i < fileCount; i++) { char[] charName = filenames[i].toCharArray(); if (knownFileNames.get(charName) != null){ - throw new InvalidInputException(Main.bind("unit.more"/*nonNLS*/,filenames[i])); + throw new InvalidInputException("File " + filenames[i] + " is specified more than once"); } else { knownFileNames.put(charName, charName); } File file = new File(filenames[i]); if (!file.exists()) - throw new InvalidInputException(Main.bind("unit.missing"/*nonNLS*/,filenames[i])); + throw new InvalidInputException("File " + filenames[i] + " is missing"); units[i] = new CompilationUnit(null, filenames[i]); } return units; @@ -711,7 +684,10 @@ } catch (IOException e) { String fileName = destinationPath + new String(relativeName); e.printStackTrace(); - System.out.println(Main.bind("output.noClassFileCreated"/*nonNLS*/,fileName)); + System.out.println( + "No .class file created for file named " + + fileName + + " because of a IOException."); } exportedClassFilesCounter++; } @@ -729,15 +705,16 @@ getOptions(), getBatchRequestor(), getProblemFactory()); + CompilerOptions options = batchCompiler.options; // set the non-externally configurable options. options.setVerboseMode(verbose); options.produceReferenceInfo(produceRefInfo); + batchCompiler.compile(getCompilationUnits()); } private void printUsage() { - out.println(Main.bind("misc.usage"/*nonNLS*/,this.versionID)); - /*out.println( + out.println( "Eclipse Java Compiler "+ this.versionID + ", Copyright IBM Corp 2000\n\n" + "Usage: <options> <source files | directories>\n\n" + "where options include:\n" + @@ -765,84 +742,7 @@ "-proceedOnError\tkeep compiling when error, \n\t\tdumping class files with problem methods\n" + "-referenceInfo\tcompute reference info\n" + "-preserveAllLocals\trequest code gen preserve all local variables\n" + - "-repeat <n>\trepeat compilation process for performance analysis\n");*/ + "-repeat <n>\trepeat compilation process for performance analysis\n"); out.flush(); } - -/** - * Creates a NLS catalog for the given locale. - */ -public static void relocalize() { - bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault()); -} - -/** - * Lookup the message with the given ID in this catalog - */ -public static String bind(String id) { - return bind(id, (String[])null); -} - -/** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given string values. - */ -public static String bind(String id, String[] bindings) { - if (id == null) - return "No message available"/*nonNLS*/; - String message = null; - try { - message = bundle.getString(id); - } catch (MissingResourceException e) { - // If we got an exception looking for the message, fail gracefully by just returning - // the id we were looking for. In most cases this is semi-informative so is not too bad. - return "Missing message: "/*nonNLS*/+id+" in: "/*nonNLS*/+bundleName; - } - if (bindings == null) - return message; - int length = message.length(); - int start = -1; - int end = length; - StringBuffer output = new StringBuffer(80); - while (true) { - if ((end = message.indexOf('{', start)) > -1) { - output.append(message.substring(start + 1, end)); - if ((start = message.indexOf('}', end)) > -1) { - int index = -1; - try { - index = Integer.parseInt(message.substring(end + 1, start)); - output.append(bindings[index]); - } catch (NumberFormatException nfe) { - output.append(message.substring(end + 1, start + 1)); - } catch (ArrayIndexOutOfBoundsException e) { - output.append("{missing "/*nonNLS*/ + Integer.toString(index) + "}"/*nonNLS*/); - } - } else { - output.append(message.substring(end, length)); - break; - } - } else { - output.append(message.substring(start + 1, length)); - break; - } - } - return output.toString(); -} - -/** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given string. - */ -public static String bind(String id, String binding) { - return bind(id, new String[] {binding}); -} - -/** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given strings. - */ -public static String bind(String id, String binding1, String binding2) { - return bind(id, new String[] {binding1, binding2}); -} - }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java index fe8b2e0..c2b8f1e 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -62,18 +62,18 @@ */ static final char[][] baseTypes = new char[][] { - "boolean"/*nonNLS*/.toCharArray(), - "byte"/*nonNLS*/.toCharArray(), - "char"/*nonNLS*/.toCharArray(), - "double"/*nonNLS*/.toCharArray(), - "float"/*nonNLS*/.toCharArray(), - "int"/*nonNLS*/.toCharArray(), - "long"/*nonNLS*/.toCharArray(), - "short"/*nonNLS*/.toCharArray(), - "void"/*nonNLS*/.toCharArray()}; + "boolean".toCharArray(), + "byte".toCharArray(), + "char".toCharArray(), + "double".toCharArray(), + "float".toCharArray(), + "int".toCharArray(), + "long".toCharArray(), + "short".toCharArray(), + "void".toCharArray()}; - static final char[] classField = "class"/*nonNLS*/.toCharArray(); - static final char[] lengthField = "length"/*nonNLS*/.toCharArray(); + static final char[] classField = "class".toCharArray(); + static final char[] lengthField = "length".toCharArray(); /** * The CompletionEngine is responsible for computing source completions. *
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/ISearchRequestor.java b/codeassist/org/eclipse/jdt/internal/codeassist/ISearchRequestor.java index 46432c4..cd45d61 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/ISearchRequestor.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/ISearchRequestor.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.internal.codeassist; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.codeassist.*; -/** - * This is the internal requestor passed to the searchable name environment - * so as to process the multiple search results as they are discovered. - * - * It is used to allow the code assist engine to add some more information - * to the raw name environment results before answering them to the UI. - */ public interface ISearchRequestor { /** * One result of the search consists of a new class.
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java b/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java index 808c774..808709d 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
@@ -227,7 +227,7 @@ public void select(ICompilationUnit sourceUnit, int selectionSourceStart, int selectionSourceEnd) { char[] source = sourceUnit.getContents(); - if (!checkSelection(source, selectionSourceStart, selectionSourceEnd)) return; + if (!checkSelection(source, selectionSourceStart, selectionSourceEnd-1)) return; try{ acceptedAnswer = false; CompilationResult result = new CompilationResult(sourceUnit, 1, 1); @@ -400,7 +400,7 @@ selectionIdentifier, new long[previousIdentifiers.length + 1]); } - field.name = "<fakeField>"/*nonNLS*/.toCharArray(); + field.name = "<fakeField>".toCharArray(); typeDecl.fields = new FieldDeclaration[] {field}; // build bindings
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnClassLiteralAccess.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnClassLiteralAccess.java index 79e6f08..91d67e2 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnClassLiteralAccess.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnClassLiteralAccess.java
@@ -41,11 +41,11 @@ throw new CompletionNodeFound(this, targetType, scope); } public String toStringExpression() { - StringBuffer result = new StringBuffer("<CompleteOnClassLiteralAccess:"/*nonNLS*/); + StringBuffer result = new StringBuffer("<CompleteOnClassLiteralAccess:"); result.append(type.toString()); - result.append("."/*nonNLS*/); + result.append("."); result.append(completionIdentifier); - result.append(">"/*nonNLS*/); + result.append(">"); return result.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnExceptionReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnExceptionReference.java index 6b14d5a..d77c1e9 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnExceptionReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnExceptionReference.java
@@ -1,41 +1,10 @@ package org.eclipse.jdt.internal.codeassist.complete; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; -/* - * Completion node build by the parser in any case it was intending to - * reduce an exception type reference containing the completion identifier. - * e.g. - * - * class X { - * void foo() { - * try { - * bar(); - * } catch (IOExc[cursor] e) { - * } - * } - * } - * - * ---> class X { - * void foo() { - * try { - * bar(); - * } catch (<CompleteOnException:IOExc> e) { - * } - * } - * } - * - * The source range of the completion node denotes the source range - * which should be replaced by the completion. - */ public class CompletionOnExceptionReference extends CompletionOnSingleTypeReference { public CompletionOnExceptionReference(char[] source, long pos) { super(source, pos); } public String toStringExpression(int tab) { - return "<CompleteOnException:"/*nonNLS*/ + new String(token) + ">"/*nonNLS*/; + return "<CompleteOnException:" + new String(token) + ">"; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnExplicitConstructorCall.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnExplicitConstructorCall.java index 33a2a6a..94afca0 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnExplicitConstructorCall.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnExplicitConstructorCall.java
@@ -48,23 +48,23 @@ } public String toString(int tab) { String s = tabString(tab); - s += "<CompleteOnExplicitConstructorCall:"/*nonNLS*/; + s += "<CompleteOnExplicitConstructorCall:"; if (qualification != null) - s = s + qualification.toStringExpression() + "."/*nonNLS*/; + s = s + qualification.toStringExpression() + "."; if (accessMode == This) { - s = s + "this("/*nonNLS*/; + s = s + "this("; } else { - s = s + "super("/*nonNLS*/; + s = s + "super("; } if (arguments != null) { for (int i = 0; i < arguments.length; i++) { s += arguments[i].toStringExpression(); if (i != arguments.length - 1) { - s += ", "/*nonNLS*/; + s += ", "; } }; } - s += ")>"/*nonNLS*/; + s += ")>"; return s; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnImportReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnImportReference.java index 33a99a1..b5e9866 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnImportReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnImportReference.java
@@ -36,14 +36,14 @@ public String toString(int tab, boolean withOnDemand) { StringBuffer buffer = new StringBuffer(tabString(tab)); - buffer. append("<CompleteOnImport:"/*nonNLS*/); + buffer. append("<CompleteOnImport:"); for (int i = 0; i < tokens.length; i++) { buffer.append(tokens[i]); if (i < (tokens.length - 1)) { - buffer.append("."/*nonNLS*/); + buffer.append("."); } } - buffer.append(">"/*nonNLS*/); + buffer.append(">"); return buffer.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMemberAccess.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMemberAccess.java index 55098d0..e70fe35 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMemberAccess.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMemberAccess.java
@@ -43,8 +43,8 @@ public String toStringExpression(){ /* slow code */ - return "<CompleteOnMemberAccess:"/*nonNLS*/ + return "<CompleteOnMemberAccess:" + super.toStringExpression() - + ">"/*nonNLS*/; + + ">"; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMessageSend.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMessageSend.java index bb9419e..ae8aa4c 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMessageSend.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMessageSend.java
@@ -45,19 +45,19 @@ public String toStringExpression() { /*slow code*/ - String s = "<CompleteOnMessageSend:"/*nonNLS*/; + String s = "<CompleteOnMessageSend:"; if (receiver != ThisReference.ThisImplicit) - s = s + receiver.toStringExpression() + "."/*nonNLS*/; - s = s + new String(selector) + "("/*nonNLS*/; + s = s + receiver.toStringExpression() + "."; + s = s + new String(selector) + "("; if (arguments != null) { for (int i = 0; i < arguments.length; i++) { s += arguments[i].toStringExpression(); if (i != arguments.length - 1) { - s += ", "/*nonNLS*/; + s += ", "; } }; } - s = s + ")>"/*nonNLS*/; + s = s + ")>"; return s; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java index 1f7e313..0fb8ae2 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java
@@ -34,14 +34,14 @@ } public String toString(int tab, boolean withOnDemand) { StringBuffer buffer = new StringBuffer(tabString(tab)); - buffer. append("<CompleteOnPackage:"/*nonNLS*/); + buffer. append("<CompleteOnPackage:"); for (int i = 0; i < tokens.length; i++) { buffer.append(tokens[i]); if (i < (tokens.length - 1)) { - buffer.append("."/*nonNLS*/); + buffer.append("."); } } - buffer.append(">"/*nonNLS*/); + buffer.append(">"); return buffer.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedAllocationExpression.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedAllocationExpression.java index 63b20d5..91c5541 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedAllocationExpression.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedAllocationExpression.java
@@ -56,8 +56,8 @@ public String toStringExpression(int tab) { return ((this.enclosingInstance == null) ? - "<CompleteOnAllocationExpression:"/*nonNLS*/ : - "<CompleteOnQualifiedAllocationExpression:"/*nonNLS*/) + - super.toStringExpression(tab) + ">"/*nonNLS*/; + "<CompleteOnAllocationExpression:" : + "<CompleteOnQualifiedAllocationExpression:") + + super.toStringExpression(tab) + ">"; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedExceptionReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedExceptionReference.java index 4d02d45..3ebb0cc 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedExceptionReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedExceptionReference.java
@@ -1,37 +1,5 @@ package org.eclipse.jdt.internal.codeassist.complete; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; -/* - * Completion node build by the parser in any case it was intending to - * reduce an exception type reference containing the completion identifier - * as part of a qualified name. - * e.g. - * - * class X { - * void foo() { - * try { - * bar(); - * } catch (java.io.IOExc[cursor] e) { - * } - * } - * } - * - * ---> class X { - * void foo() { - * try { - * bar(); - * } catch (<CompleteOnException:java.io.IOExc> e) { - * } - * } - * } - * - * The source range of the completion node denotes the source range - * which should be replaced by the completion. - */ public class CompletionOnQualifiedExceptionReference extends CompletionOnQualifiedTypeReference { public CompletionOnQualifiedExceptionReference(char[][] previousIdentifiers, char[] completionIdentifier, long[] positions) { super(previousIdentifiers, completionIdentifier, positions); @@ -39,12 +7,12 @@ public String toStringExpression(int tab) { StringBuffer buffer = new StringBuffer(); - buffer. append("<CompleteOnException:"/*nonNLS*/); + buffer. append("<CompleteOnException:"); for (int i = 0; i < tokens.length; i++) { buffer.append(tokens[i]); - buffer.append("."/*nonNLS*/); + buffer.append("."); } - buffer.append(completionIdentifier).append(">"/*nonNLS*/); + buffer.append(completionIdentifier).append(">"); return buffer.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedNameReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedNameReference.java index df2ef46..52a91c9 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedNameReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedNameReference.java
@@ -41,7 +41,7 @@ public CompletionOnQualifiedNameReference(char[][] previousIdentifiers, char[] completionIdentifier, int sourceStart, int sourceEnd) { super(previousIdentifiers, sourceStart, sourceEnd); this.completionIdentifier = completionIdentifier; - this.sourcePositions = new long[] {((long)sourceStart << 32) + sourceEnd}; + this.sourcePositions = new long[] {(sourceStart << 32) + sourceEnd}; } public TypeBinding resolveType(BlockScope scope) { // it can be a package, type, member type, local variable or field @@ -61,12 +61,12 @@ } public String toStringExpression() { - StringBuffer buffer = new StringBuffer("<CompleteOnName:"/*nonNLS*/); + StringBuffer buffer = new StringBuffer("<CompleteOnName:"); for (int i = 0; i < tokens.length; i++) { buffer.append(tokens[i]); - buffer.append("."/*nonNLS*/); + buffer.append("."); } - buffer.append(completionIdentifier).append(">"/*nonNLS*/); + buffer.append(completionIdentifier).append(">"); return buffer.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java index d1a29bd..40d64b8 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java
@@ -49,12 +49,12 @@ public String toStringExpression(int tab) { StringBuffer buffer = new StringBuffer(); - buffer.append("<CompleteOnType:"/*nonNLS*/); + buffer.append("<CompleteOnType:"); for (int i = 0; i < tokens.length; i++) { buffer.append(tokens[i]); - buffer.append("."/*nonNLS*/); + buffer.append("."); } - buffer.append(completionIdentifier).append(">"/*nonNLS*/); + buffer.append(completionIdentifier).append(">"); return buffer.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleNameReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleNameReference.java index 71cc394..c30504b 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleNameReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleNameReference.java
@@ -36,6 +36,6 @@ throw new CompletionNodeFound(this, scope); } public String toStringExpression() { - return "<CompleteOnName:"/*nonNLS*/ + super.toStringExpression() + ">"/*nonNLS*/; + return "<CompleteOnName:" + super.toStringExpression() + ">"; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java index f9c4c6d..0f5fb5a 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java
@@ -42,6 +42,6 @@ } public String toStringExpression(int tab){ - return "<CompleteOnType:"/*nonNLS*/ + new String(token) + ">"/*nonNLS*/ ; + return "<CompleteOnType:" + new String(token) + ">" ; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java index d5e48dc..8efd5dc 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java
@@ -645,7 +645,7 @@ if (atEnd()) return TokenNameEOF; //the atEnd may not be <currentPosition == source.length> if source is only some part of a real (external) stream - throw new InvalidInputException("Ctrl-Z"/*nonNLS*/); + throw new InvalidInputException("Ctrl-Z"); default : if (Character.isJavaIdentifierStart(currentCharacter))
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/complete/InvalidCursorLocation.java b/codeassist/org/eclipse/jdt/internal/codeassist/complete/InvalidCursorLocation.java index 543d318..d89203e 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/complete/InvalidCursorLocation.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/complete/InvalidCursorLocation.java
@@ -1,24 +1,15 @@ package org.eclipse.jdt.internal.codeassist.complete; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.codeassist.impl.Engine; -/** - * Thrown whenever cursor location is not inside a consistent token - * i.e. inside a string, number, unicode, comments etc... - */ public class InvalidCursorLocation extends RuntimeException { public String irritant; /* Possible irritants */ - public static final String NO_COMPLETION_INSIDE_UNICODE = "No Completion Inside Unicode"/*nonNLS*/; - public static final String NO_COMPLETION_INSIDE_COMMENT = "No Completion Inside Comment"/*nonNLS*/; - public static final String NO_COMPLETION_INSIDE_STRING = "No Completion Inside String"/*nonNLS*/; - public static final String NO_COMPLETION_INSIDE_NUMBER = "No Completion Inside Number"/*nonNLS*/; - + public static final String NO_COMPLETION_INSIDE_UNICODE = "No Completion Inside Unicode"; + public static final String NO_COMPLETION_INSIDE_COMMENT = "No Completion Inside Comment"; + public static final String NO_COMPLETION_INSIDE_STRING = "No Completion Inside String"; + public static final String NO_COMPLETION_INSIDE_NUMBER = "No Completion Inside Number"; + public InvalidCursorLocation(String irritant){ this.irritant = irritant; }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnExplicitConstructorCall.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnExplicitConstructorCall.java index c129f32..6ab945a 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnExplicitConstructorCall.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnExplicitConstructorCall.java
@@ -40,23 +40,23 @@ } public String toString(int tab) { String s = tabString(tab); - s += "<SelectOnExplicitConstructorCall:"/*nonNLS*/; + s += "<SelectOnExplicitConstructorCall:"; if (qualification != null) - s = s + qualification.toStringExpression() + "."/*nonNLS*/; + s = s + qualification.toStringExpression() + "."; if (accessMode == This) { - s = s + "this("/*nonNLS*/; + s = s + "this("; } else { - s = s + "super("/*nonNLS*/; + s = s + "super("; } if (arguments != null) { for (int i = 0; i < arguments.length; i++) { s += arguments[i].toStringExpression(); if (i != arguments.length - 1) { - s += ", "/*nonNLS*/; + s += ", "; } }; } - s += ")>"/*nonNLS*/; + s += ")>"; return s; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnFieldReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnFieldReference.java index 47688f7..2603644 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnFieldReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnFieldReference.java
@@ -41,8 +41,8 @@ public String toStringExpression(){ /* slow code */ - return "<SelectionOnFieldReference:"/*nonNLS*/ + return "<SelectionOnFieldReference:" + super.toStringExpression() - + ">"/*nonNLS*/; + + ">"; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnImportReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnImportReference.java index fa29b31..0d3ff03 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnImportReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnImportReference.java
@@ -33,14 +33,14 @@ public String toString(int tab, boolean withOnDemand) { StringBuffer buffer = new StringBuffer(tabString(tab)); - buffer. append("<SelectOnImport:"/*nonNLS*/); + buffer. append("<SelectOnImport:"); for (int i = 0; i < tokens.length; i++) { buffer.append(tokens[i]); if (i < (tokens.length - 1)) { - buffer.append("."/*nonNLS*/); + buffer.append("."); } } - buffer.append(">"/*nonNLS*/); + buffer.append(">"); return buffer.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnMessageSend.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnMessageSend.java index 262dfdb..305b8af 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnMessageSend.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnMessageSend.java
@@ -38,19 +38,19 @@ public String toStringExpression() { /*slow code*/ - String s = "<SelectOnMessageSend:"/*nonNLS*/; + String s = "<SelectOnMessageSend:"; if (receiver != ThisReference.ThisImplicit) - s = s + receiver.toStringExpression() + "."/*nonNLS*/; - s = s + new String(selector) + "("/*nonNLS*/; + s = s + receiver.toStringExpression() + "."; + s = s + new String(selector) + "("; if (arguments != null) { for (int i = 0; i < arguments.length; i++) { s += arguments[i].toStringExpression(); if (i != arguments.length - 1) { - s += ", "/*nonNLS*/; + s += ", "; } }; } - s = s + ")>"/*nonNLS*/; + s = s + ")>"; return s; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java index 58460d3..be94bb9 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java
@@ -31,14 +31,14 @@ } public String toString(int tab, boolean withOnDemand) { StringBuffer buffer = new StringBuffer(tabString(tab)); - buffer. append("<SelectOnPackage:"/*nonNLS*/); + buffer. append("<SelectOnPackage:"); for (int i = 0; i < tokens.length; i++) { buffer.append(tokens[i]); if (i < (tokens.length - 1)) { - buffer.append("."/*nonNLS*/); + buffer.append("."); } } - buffer.append(">"/*nonNLS*/); + buffer.append(">"); return buffer.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedAllocationExpression.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedAllocationExpression.java index f590a7d..c64ebaf 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedAllocationExpression.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedAllocationExpression.java
@@ -57,8 +57,8 @@ public String toStringExpression(int tab) { return ((this.enclosingInstance == null) ? - "<SelectOnAllocationExpression:"/*nonNLS*/ : - "<SelectOnQualifiedAllocationExpression:"/*nonNLS*/) + - super.toStringExpression(tab) + ">"/*nonNLS*/; + "<SelectOnAllocationExpression:" : + "<SelectOnQualifiedAllocationExpression:") + + super.toStringExpression(tab) + ">"; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedNameReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedNameReference.java index d6cd44f..5f6827c 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedNameReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedNameReference.java
@@ -56,13 +56,13 @@ } public String toStringExpression() { - StringBuffer buffer = new StringBuffer("<SelectOnName:"/*nonNLS*/); + StringBuffer buffer = new StringBuffer("<SelectOnName:"); for (int i = 0, length = tokens.length; i < length; i++) { buffer.append(tokens[i]); if (i != length - 1) - buffer.append("."/*nonNLS*/); + buffer.append("."); } - buffer.append(">"/*nonNLS*/); + buffer.append(">"); return buffer.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedSuperReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedSuperReference.java index d4c9138..ac6db1e 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedSuperReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedSuperReference.java
@@ -45,9 +45,9 @@ } public String toStringExpression(){ - StringBuffer buffer = new StringBuffer("<SelectOnQualifiedSuper:"/*nonNLS*/); + StringBuffer buffer = new StringBuffer("<SelectOnQualifiedSuper:"); buffer.append(super.toStringExpression()); - buffer.append(">"/*nonNLS*/); + buffer.append(">"); return buffer.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java index fb94e29..c0a29d7 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java
@@ -42,13 +42,13 @@ public String toStringExpression(int tab) { StringBuffer buffer = new StringBuffer(); - buffer.append("<SelectOnType:"/*nonNLS*/); + buffer.append("<SelectOnType:"); for (int i = 0, length = tokens.length; i < length; i++) { buffer.append(tokens[i]); if (i != length - 1) - buffer.append("."/*nonNLS*/); + buffer.append("."); } - buffer.append(">"/*nonNLS*/); + buffer.append(">"); return buffer.toString(); } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleNameReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleNameReference.java index f79a4f6..fa3736a 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleNameReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleNameReference.java
@@ -47,6 +47,6 @@ throw new SelectionNodeFound(binding); } public String toStringExpression() { - return "<SelectOnName:"/*nonNLS*/ + super.toStringExpression() + ">"/*nonNLS*/; + return "<SelectOnName:" + super.toStringExpression() + ">"; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java index 2563291..15003e6 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java
@@ -46,6 +46,6 @@ } public String toStringExpression(int tab){ - return "<SelectOnType:"/*nonNLS*/ + new String(token) + ">"/*nonNLS*/ ; + return "<SelectOnType:" + new String(token) + ">" ; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSuperReference.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSuperReference.java index ea6450a..5d63cd8 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSuperReference.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSuperReference.java
@@ -46,7 +46,7 @@ } public String toStringExpression(){ - return "<SelectOnSuper:"/*nonNLS*/+super.toStringExpression()+">"/*nonNLS*/; + return "<SelectOnSuper:"+super.toStringExpression()+">"; } }
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java index 2752e8d..897cae7 100644 --- a/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java +++ b/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
@@ -30,7 +30,7 @@ public int selectionStart, selectionEnd; public AstNode selectionNode; - public static final char[] SUPER = "super"/*nonNLS*/.toCharArray(); + public static final char[] SUPER = "super".toCharArray(); public SelectionParser(ProblemReporter problemReporter) { super(problemReporter); }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java b/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java index 8b5b98a..8813f81 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
@@ -519,7 +519,7 @@ int codeAttributeOffset = contentsOffset; generateCodeAttributeHeader(); codeStream.resetForProblemClinit(this); - String problemString = ""/*nonNLS*/; + String problemString = ""; if (problems != null) { int max = problems.length; StringBuffer buffer = new StringBuffer(25); @@ -527,7 +527,7 @@ for (int i = 0; i < max; i++) { IProblem problem = problems[i]; if ((problem != null) && (problem.isError())) { - buffer.append("\t"/*nonNLS*/ + problem.getMessage() + "\n"/*nonNLS*/); + buffer.append("\t" + problem.getMessage() + "\n"); count++; if (problemLine == 0) { problemLine = problem.getSourceLineNumber(); @@ -536,9 +536,9 @@ } } // insert the top line afterwards, once knowing how many problems we have to consider if (count > 1) { - buffer.insert(0, Util.bind("compilation.unresolvedProblems"/*nonNLS*/)); + buffer.insert(0, "Unresolved compilation problems: \n"); } else { - buffer.insert(0, Util.bind("compilation.unresolvedProblem"/*nonNLS*/)); + buffer.insert(0, "Unresolved compilation problem: \n"); } problemString = buffer.toString(); } @@ -581,7 +581,7 @@ generateCodeAttributeHeader(); final ProblemReporter problemReporter = method.scope.problemReporter(); codeStream.reset(method, this); - String problemString = ""/*nonNLS*/; + String problemString = ""; if (problems != null) { int max = problems.length; StringBuffer buffer = new StringBuffer(25); @@ -589,7 +589,7 @@ for (int i = 0; i < max; i++) { IProblem problem = problems[i]; if ((problem != null) && (problem.isError())) { - buffer.append("\t"/*nonNLS*/ + problem.getMessage() + "\n"/*nonNLS*/); + buffer.append("\t" + problem.getMessage() + "\n"); count++; if (problemLine == 0) { problemLine = problem.getSourceLineNumber(); @@ -597,9 +597,9 @@ } } // insert the top line afterwards, once knowing how many problems we have to consider if (count > 1) { - buffer.insert(0, Util.bind("compilation.unresolvedProblems"/*nonNLS*/)); + buffer.insert(0, "Unresolved compilation problems: \n"); } else { - buffer.insert(0, Util.bind("compilation.unresolvedProblem"/*nonNLS*/)); + buffer.insert(0, "Unresolved compilation problem: \n"); } problemString = buffer.toString(); } @@ -710,7 +710,7 @@ generateCodeAttributeHeader(); final ProblemReporter problemReporter = method.scope.problemReporter(); codeStream.reset(method, this); - String problemString = ""/*nonNLS*/; + String problemString = ""; if (problems != null) { int max = problems.length; StringBuffer buffer = new StringBuffer(25); @@ -721,7 +721,7 @@ && (problem.isError()) && (problem.getSourceStart() >= method.declarationSourceStart) && (problem.getSourceEnd() <= method.declarationSourceEnd)) { - buffer.append("\t"/*nonNLS*/ + problem.getMessage() + "\n"/*nonNLS*/); + buffer.append("\t" + problem.getMessage() + "\n"); count++; if (problemLine == 0) { problemLine = problem.getSourceLineNumber(); @@ -730,9 +730,9 @@ } } // insert the top line afterwards, once knowing how many problems we have to consider if (count > 1) { - buffer.insert(0, Util.bind("compilation.unresolvedProblems"/*nonNLS*/)); + buffer.insert(0, "Unresolved compilation problems: \n"); } else { - buffer.insert(0, Util.bind("compilation.unresolvedProblem"/*nonNLS*/)); + buffer.insert(0, "Unresolved compilation problem: \n"); } problemString = buffer.toString(); } @@ -958,14 +958,14 @@ f = new File(outputPath); if (f.exists()) { if (!f.isDirectory()) { - System.out.println(Util.bind("output.isFile"/*nonNLS*/,f.getAbsolutePath())); - throw new IOException(Util.bind("output.isFileNotDirectory"/*nonNLS*/)); + System.out.println(" The outDir is a file = " + f.getAbsolutePath()); + throw new IOException("The outDir is a file not a directory."); } } else { // we have to create that directory if (!f.mkdirs()) { - System.out.println(Util.bind("output.dirName"/*nonNLS*/,f.getAbsolutePath())); - throw new IOException(Util.bind("output.notValidAll"/*nonNLS*/)); + System.out.println(" The output dir name is = " + f.getAbsolutePath()); + throw new IOException("The outDir is not a valid directory name. All the directories cannot be created."); } } StringBuffer outDir = new StringBuffer(outputPath); @@ -980,8 +980,8 @@ } else { // Need to add the outDir if (!f.mkdir()) { - System.out.println(Util.bind("output.fileName"/*nonNLS*/,f.getName())); - throw new IOException(Util.bind("output.notValid"/*nonNLS*/)); + System.out.println(" file name = " + f.getName()); + throw new IOException("The outDir is not a valid directory name. The directory cannot be created."); } } token = tokenizer.nextToken(); @@ -1203,7 +1203,7 @@ if (startPC != endPC) { // only entries for non zero length int currentLength; if (endPC == -1) { - localVariable.declaringScope.problemReporter().abortDueToInternalError(Util.bind("abort.invalidAttribute"/*nonNLS*/,new String(localVariable.name)), (AstNode) localVariable.declaringScope.methodScope().referenceContext); + localVariable.declaringScope.problemReporter().abortDueToInternalError("SANITY CHECK: Invalid attribute for local variable " + new String(localVariable.name), (AstNode) localVariable.declaringScope.methodScope().referenceContext); } if (localContentsOffset + 10 >= (contentsLength = localContents.length)) { System.arraycopy(contents, 0, (localContents = contents = new byte[contentsLength + INCREMENT_SIZE]), 0, contentsLength); @@ -1407,7 +1407,7 @@ if (startPC != endPC) { // only entries for non zero length int currentLength; if (endPC == -1) { - localVariable.declaringScope.problemReporter().abortDueToInternalError(Util.bind("abort.invalidAttribute"/*nonNLS*/,new String(localVariable.name)), (AstNode) localVariable.declaringScope.methodScope().referenceContext); + localVariable.declaringScope.problemReporter().abortDueToInternalError("SANITY CHECK: Invalid attribute for local variable " + new String(localVariable.name), (AstNode) localVariable.declaringScope.methodScope().referenceContext); } if (localContentsOffset + 10 >= (contentsLength = localContents.length)) { System.arraycopy(contents, 0, (localContents = contents = new byte[contentsLength + INCREMENT_SIZE]), 0, contentsLength); @@ -1878,7 +1878,7 @@ if (startPC != endPC) { // only entries for non zero length int currentLength; if (endPC == -1) { - localVariable.declaringScope.problemReporter().abortDueToInternalError(Util.bind("abort.invalidAttribute"/*nonNLS*/,new String(localVariable.name)), (AstNode) localVariable.declaringScope.methodScope().referenceContext); + localVariable.declaringScope.problemReporter().abortDueToInternalError("SANITY CHECK: Invalid attribute for local variable " + new String(localVariable.name), (AstNode) localVariable.declaringScope.methodScope().referenceContext); } if (localContentsOffset + 10 > (contentsLength = contents.length)) { System.arraycopy(contents, 0, (contents = new byte[contentsLength + INCREMENT_SIZE]), 0, contentsLength);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/Compiler.java b/compiler/org/eclipse/jdt/internal/compiler/Compiler.java index f7cf45e..2506e79 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/Compiler.java +++ b/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
@@ -112,7 +112,13 @@ } if (options.verbose) { - System.out.println(Util.bind("compilation.request"/*nonNLS*/,new String[]{String.valueOf(totalUnits + 1),String.valueOf(totalUnits + 1),new String(sourceUnit.getFileName())})); + System.out.println( + "request " + + (totalUnits + 1) + + "/" + + (totalUnits + 1) + + " : " + + new String(sourceUnit.getFileName())); } // initial type binding creation @@ -136,7 +142,12 @@ */ public void accept(ISourceType sourceType, PackageBinding packageBinding) { - problemReporter.abortDueToInternalError(Util.bind("abort.againstSourceModel "/*nonNLS*/,String.valueOf(sourceType.getName()),String.valueOf(sourceType.getFileName()))); + problemReporter.abortDueToInternalError( + new StringBuffer("Cannot compile against source model ") + .append(sourceType.getName()) + .append(" issued from ") + .append(sourceType.getFileName()) + .toString()); } protected void addCompilationUnit(ICompilationUnit sourceUnit, CompilationUnitDeclaration parsedUnit) { @@ -166,7 +177,7 @@ else { parsedUnit = parser.dietParse(sourceUnits[i], unitResult);} if (options.verbose) { - System.out.println(Util.bind("compilation.request"/*nonNLS*/,new String[]{String.valueOf(i+1),String.valueOf(maxUnits),new String(sourceUnits[i].getFileName())})); + System.out.println("request " + (i+1) + "/" + maxUnits + " : " + new String(sourceUnits[i].getFileName())); } // initial type binding creation lookupEnvironment.buildTypeBindings(parsedUnit); @@ -198,13 +209,13 @@ for (; i < totalUnits; i++) { unit = unitsToProcess[i]; try { - if (options.verbose) System.out.println(Util.bind("compilation.process"/*nonNLS*/,new String[]{String.valueOf(i + 1),String.valueOf(totalUnits),new String(unitsToProcess[i].getFileName())})); + if (options.verbose) System.out.println( "process " + (i + 1) + "/" + totalUnits + " : " + new String(unitsToProcess[i].getFileName())); process(unit, i); } finally { // cleanup compilation unit result unit.cleanUp(); if (options.verbose) - System.out.println(Util.bind("compilation.done"/*nonNLS*/,new String[]{String.valueOf(i + 1),String.valueOf(totalUnits),new String(unitsToProcess[i].getFileName())})); + System.out.println("done " + (i + 1) + "/" + totalUnits + " : " + new String(unitsToProcess[i].getFileName())); } unitsToProcess[i] = null; // release reference to processed unit declaration requestor.acceptResult(unit.compilationResult.tagAsAccepted()); @@ -222,9 +233,9 @@ } if (options.verbose) { if (totalUnits > 1) { - System.out.println(Util.bind("compilation.units"/*nonNLS*/,String.valueOf(totalUnits))); + System.out.println(totalUnits + " units compiled"); } else { - System.out.println(Util.bind("compilation.unit"/*nonNLS*/,String.valueOf(totalUnits))); + System.out.println(totalUnits + " unit compiled"); } } } @@ -281,7 +292,7 @@ problemReporter.createProblem( result.getFileName(), ProblemIrritants.UnclassifiedProblem, - new String[] {Util.bind("compilation.internalError"/*nonNLS*/)+"\n"/*nonNLS*/ + buffer.toString()}, + new String[] {"Internal compiler error\n" + buffer.toString()}, Error, // severity 0, // source start 0, // source end
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ConfigurableOption.java b/compiler/org/eclipse/jdt/internal/compiler/ConfigurableOption.java index 6a88d97..32a3e9c 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ConfigurableOption.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ConfigurableOption.java
@@ -44,34 +44,34 @@ ResourceBundle resource = null; try { String location = componentName.substring(0, componentName.lastIndexOf('.')); - resource = ResourceBundle.getBundle(location + ".Options"/*nonNLS*/, loc); + resource = ResourceBundle.getBundle(location + ".Options", loc); } catch (MissingResourceException e) { - category = "Missing ressources entries for"/*nonNLS*/ + componentName + " options"/*nonNLS*/; - name = "Missing ressources entries for"/*nonNLS*/ + componentName + " options"/*nonNLS*/; - description = "Missing ressources entries for"/*nonNLS*/ + componentName + " options"/*nonNLS*/; + category = "Missing ressources entries for" + componentName + " options"; + name = "Missing ressources entries for" + componentName + " options"; + description = "Missing ressources entries for" + componentName + " options"; possibleValues = new String[0]; id = -1; } if (resource == null) return; try { - id = Integer.parseInt(resource.getString(optionName + ".number"/*nonNLS*/)); + id = Integer.parseInt(resource.getString(optionName + ".number")); } catch (MissingResourceException e) { id = -1; } catch (NumberFormatException e) { id = -1; } try { - category = resource.getString(optionName + ".category"/*nonNLS*/); + category = resource.getString(optionName + ".category"); } catch (MissingResourceException e) { - category = "Missing ressources entries for"/*nonNLS*/ + componentName + " options"/*nonNLS*/; + category = "Missing ressources entries for" + componentName + " options"; } try { - name = resource.getString(optionName + ".name"/*nonNLS*/); + name = resource.getString(optionName + ".name"); } catch (MissingResourceException e) { - name = "Missing ressources entries for"/*nonNLS*/ + componentName + " options"/*nonNLS*/; + name = "Missing ressources entries for" + componentName + " options"; } try { - StringTokenizer tokenizer = new StringTokenizer(resource.getString(optionName + ".possibleValues"/*nonNLS*/), "|"/*nonNLS*/); + StringTokenizer tokenizer = new StringTokenizer(resource.getString(optionName + ".possibleValues"), "|"); int numberOfValues = Integer.parseInt(tokenizer.nextToken()); if(numberOfValues == -1){ possibleValues = NoDiscreteValue; @@ -91,9 +91,9 @@ possibleValues = new String[0]; } try { - description = resource.getString(optionName + ".description"/*nonNLS*/); + description = resource.getString(optionName + ".description"); } catch (MissingResourceException e) { - description = "Missing ressources entries for"/*nonNLS*/ + componentName + " options"/*nonNLS*/; + description = "Missing ressources entries for" + componentName + " options"; } } /** @@ -182,31 +182,31 @@ } public String toString() { StringBuffer buffer = new StringBuffer(); - buffer.append("Configurable option for "/*nonNLS*/); - buffer.append(this.componentName).append("\n"/*nonNLS*/); - buffer.append("- category: "/*nonNLS*/).append(this.category).append("\n"/*nonNLS*/); - buffer.append("- name: "/*nonNLS*/).append(this.name).append("\n"/*nonNLS*/); + buffer.append("Configurable option for "); + buffer.append(this.componentName).append("\n"); + buffer.append("- category: ").append(this.category).append("\n"); + buffer.append("- name: ").append(this.name).append("\n"); /* display current value */ - buffer.append("- current value: "/*nonNLS*/); + buffer.append("- current value: "); if (possibleValues == NoDiscreteValue){ buffer.append(this.currentValueIndex); } else { buffer.append(this.possibleValues[this.currentValueIndex]); } - buffer.append("\n"/*nonNLS*/); + buffer.append("\n"); /* display possible values */ if (possibleValues != NoDiscreteValue){ - buffer.append("- possible values: ["/*nonNLS*/); + buffer.append("- possible values: ["); for (int i = 0, max = possibleValues.length; i < max; i++) { if (i != 0) - buffer.append(", "/*nonNLS*/); + buffer.append(", "); buffer.append(possibleValues[i]); } - buffer.append("]\n"/*nonNLS*/); - buffer.append("- curr. val. index: "/*nonNLS*/).append(currentValueIndex).append("\n"/*nonNLS*/); + buffer.append("]\n"); + buffer.append("- curr. val. index: ").append(currentValueIndex).append("\n"); } - buffer.append("- description: "/*nonNLS*/).append(description).append("\n"/*nonNLS*/); + buffer.append("- description: ").append(description).append("\n"); return buffer.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/DefaultErrorHandlingPolicies.java b/compiler/org/eclipse/jdt/internal/compiler/DefaultErrorHandlingPolicies.java index 70e19d2..a6c8de8 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/DefaultErrorHandlingPolicies.java +++ b/compiler/org/eclipse/jdt/internal/compiler/DefaultErrorHandlingPolicies.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.compiler; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.problem.ProblemHandler; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ public class DefaultErrorHandlingPolicies { /*
diff --git a/compiler/org/eclipse/jdt/internal/compiler/DocumentElementParser.java b/compiler/org/eclipse/jdt/internal/compiler/DocumentElementParser.java index d49cd5c..9fac6fe 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/DocumentElementParser.java +++ b/compiler/org/eclipse/jdt/internal/compiler/DocumentElementParser.java
@@ -1259,7 +1259,7 @@ } public String toString() { StringBuffer buffer = new StringBuffer(); - buffer.append("intArrayPtr = "/*nonNLS*/ + intArrayPtr + "\n"/*nonNLS*/); + buffer.append("intArrayPtr = " + intArrayPtr + "\n"); buffer.append(super.toString()); return buffer.toString(); }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/HierarchyResolver.java b/compiler/org/eclipse/jdt/internal/compiler/HierarchyResolver.java index 0ff225f..c4dc2b6 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/HierarchyResolver.java +++ b/compiler/org/eclipse/jdt/internal/compiler/HierarchyResolver.java
@@ -70,9 +70,9 @@ */ public void accept(ICompilationUnit sourceUnit) { - //System.out.println("Cannot accept compilation units inside the HierarchyResolver."); + System.out.println("Cannot accept compilation units inside the HierarchyResolver."); lookupEnvironment.problemReporter.abortDueToInternalError( - new StringBuffer(Util.bind("accept.cannot"/*nonNLS*/)) + new StringBuffer("Cannot accept the compilation unit: ") .append(sourceUnit.getFileName()) .toString()); } @@ -275,8 +275,6 @@ lookupEnvironment.completeTypeBindings(units[i], false); reportHierarchy(); - - } catch (ClassCastException e){ // work-around for 1GF5W1S - can happen in case duplicates are fed to the hierarchy with binaries hiding sources } catch (AbortCompilation e) { // ignore this exception for now since it typically means we cannot find java.lang.Object } finally { reset();
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ICompilerRequestor.java b/compiler/org/eclipse/jdt/internal/compiler/ICompilerRequestor.java index 5790ba3..f5475b1 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ICompilerRequestor.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ICompilerRequestor.java
@@ -1,13 +1,5 @@ package org.eclipse.jdt.internal.compiler; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.Compiler; -/** - * A callback interface for receiving compilation results. - */ public interface ICompilerRequestor { /** * Accept a compilation result.
diff --git a/compiler/org/eclipse/jdt/internal/compiler/IErrorHandlingPolicy.java b/compiler/org/eclipse/jdt/internal/compiler/IErrorHandlingPolicy.java index 96ed4b9..9cbd6e9 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/IErrorHandlingPolicy.java +++ b/compiler/org/eclipse/jdt/internal/compiler/IErrorHandlingPolicy.java
@@ -1,21 +1,4 @@ package org.eclipse.jdt.internal.compiler; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.problem.ProblemHandler; - -/* - * Handler policy is responsible to answer the 2 following - * questions: - * 1. should the handler stop on first problem which appears - * to be a real error (i.e. not a warning), - * 2. should it proceed once it has gathered all problems - * - * The intent is that one can supply its own policy to implement - * some interactive error handling strategy where some UI would - * display problems and ask user if he wants to proceed or not. - */ public interface IErrorHandlingPolicy { boolean proceedOnErrors();
diff --git a/compiler/org/eclipse/jdt/internal/compiler/IProblem.java b/compiler/org/eclipse/jdt/internal/compiler/IProblem.java index b67f0fe..61df150 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/IProblem.java +++ b/compiler/org/eclipse/jdt/internal/compiler/IProblem.java
@@ -1,21 +1,4 @@ package org.eclipse.jdt.internal.compiler; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.problem.ProblemHandler; - -/* - * Handler policy is responsible to answer the 2 following - * questions: - * 1. should the handler stop on first problem which appears - * to be a real error (i.e. not a warning), - * 2. should it proceed once it has gathered all problems - * - * The intent is that one can supply its own policy to implement - * some interactive error handling strategy where some UI would - * display problems and ask user if he wants to proceed or not. - */ public interface IProblem { final int Error = 1; // when bit is set: problem is error, if not it is a warning
diff --git a/compiler/org/eclipse/jdt/internal/compiler/SourceElementParser.java b/compiler/org/eclipse/jdt/internal/compiler/SourceElementParser.java index 4529056..878bd4c 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/SourceElementParser.java +++ b/compiler/org/eclipse/jdt/internal/compiler/SourceElementParser.java
@@ -42,7 +42,7 @@ private char[][] typeNames; private char[][] superTypeNames; private int nestedTypeIndex; - private static final char[] JAVA_LANG_OBJECT = "java.lang.Object"/*nonNLS*/.toCharArray(); + private static final char[] JAVA_LANG_OBJECT = "java.lang.Object".toCharArray(); public SourceElementParser( final ISourceElementRequestor requestor, IProblemFactory problemFactory) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java index 14e6800..f0e876d 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
@@ -29,7 +29,7 @@ public boolean ignoreFurtherInvestigation = false; public boolean needFreeReturn = false; public LocalVariableBinding secretReturnValue; - static final char[] SecretLocalDeclarationName = " returnValue"/*nonNLS*/.toCharArray(); + static final char[] SecretLocalDeclarationName = " returnValue".toCharArray(); public int bodyStart; public int bodyEnd = -1; @@ -249,7 +249,7 @@ public String returnTypeToString(int tab) { /*slow code */ - return ""/*nonNLS*/; + return ""; } public void tagAsHavingErrors() { ignoreFurtherInvestigation = true; @@ -264,21 +264,21 @@ s += returnTypeToString(0); - s += new String(selector) + "("/*nonNLS*/; + s += new String(selector) + "("; if (arguments != null) { for (int i = 0; i < arguments.length; i++) { s += arguments[i].toString(0); if (i != (arguments.length - 1)) - s = s + ", "/*nonNLS*/; + s = s + ", "; }; }; - s += ")"/*nonNLS*/; + s += ")"; if (thrownExceptions != null) { - s += " throws "/*nonNLS*/; + s += " throws "; for (int i = 0; i < thrownExceptions.length; i++) { s += thrownExceptions[i].toString(0); if (i != (thrownExceptions.length - 1)) - s = s + ", "/*nonNLS*/; + s = s + ", "; }; }; @@ -289,18 +289,18 @@ public String toStringStatements(int tab) { /* slow code */ - if (isAbstract() || (this.modifiers & AccSemicolonBody) != 0) return ";"/*nonNLS*/; + if (isAbstract() || (this.modifiers & AccSemicolonBody) != 0) return ";"; - String s = " {"/*nonNLS*/; + String s = " {"; if (statements != null) { for (int i = 0; i < statements.length; i++){ - s = s + "\n"/*nonNLS*/ + statements[i].toString(tab); + s = s + "\n" + statements[i].toString(tab); if (!(statements[i] instanceof Block)){ - s += ";"/*nonNLS*/; + s += ";"; } } } - s += "\n"/*nonNLS*/ + tabString(tab == 0 ? 0 : tab - 1) + "}"/*nonNLS*/; + s += "\n" + tabString(tab == 0 ? 0 : tab - 1) + "}"; return s; } public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope classScope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java b/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java index 8539431..4eaa8f0 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java
@@ -21,7 +21,7 @@ public AbstractVariableDeclaration(){} public String name(){ - return "anonymous storage box"/*nonNLS*/; } + return "anonymous storage box"; } public String toString(int tab) { /*slow code*/ @@ -29,9 +29,9 @@ if (modifiers != AccDefault) { s += modifiersString(modifiers); } - s += type.toString(0) + " "/*nonNLS*/ + new String(name()); + s += type.toString(0) + " " + new String(name()); if (initialization != null) - s += " = "/*nonNLS*/ + initialization.toStringExpression(tab); + s += " = " + initialization.toStringExpression(tab); return s; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java index 6b1a523..ca24c4b 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
@@ -139,21 +139,21 @@ if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null) argHasError = true; if (argHasError) - return typeBinding; + return null; } if (typeBinding == null) return null; if (!typeBinding.canBeInstantiated()) { scope.problemReporter().cannotInstantiate(type, typeBinding); - return typeBinding; + return null; } ReferenceBinding allocatedType = (ReferenceBinding) typeBinding; if (!(binding = scope.getConstructor(allocatedType, argumentTypes, this)).isValidBinding()) { if (binding.declaringClass == null) binding.declaringClass = allocatedType; scope.problemReporter().invalidConstructor(this, binding); - return typeBinding; + return null; } if (isMethodUseDeprecated(binding, scope)) scope.problemReporter().deprecatedMethod(binding, this); @@ -172,17 +172,17 @@ public String toStringExpression() { /* slow code */ - String s = "new "/*nonNLS*/ + type.toString(0); + String s = "new " + type.toString(0); if (arguments == null) - s = s + "()"/*nonNLS*/ ; + s = s + "()" ; else - { s = s + "("/*nonNLS*/; + { s = s + "("; for (int i = 0 ; i < arguments.length ; i++) { s = s + arguments[i].toStringExpression(); if (i == (arguments.length-1)) - s = s + ")"/*nonNLS*/ ; + s = s + ")" ; else - s = s + ", "/*nonNLS*/; };}; + s = s + ", "; };}; return s ;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java b/compiler/org/eclipse/jdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java index aaa8ee6..52b1450 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java
@@ -23,7 +23,7 @@ //Add to method'set, the default constuctor that just recall the //super constructor with the same arguments - String baseName = "$anonymous"/*nonNLS*/; + String baseName = "$anonymous"; TypeBinding[] argumentTypes = inheritedConstructorBinding.parameters; int argumentsLength = argumentTypes.length; //the constructor
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java index 0b3a7cb..a18b8ae 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java
@@ -42,14 +42,14 @@ public String toString(int tab){ /* slow code */ - String s = ""/*nonNLS*/; + String s = ""; if (modifiers != AccDefault){ s += modifiersString(modifiers); } if (type == null){ - s += "<no type> "/*nonNLS*/; + s += "<no type> "; } else { - s += type.toString(tab) + " "/*nonNLS*/; + s += type.toString(tab) + " "; } s += new String(name); return s;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java index d50691d..fab1005 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java
@@ -134,12 +134,12 @@ public String toStringExpression() { /* slow code */ - String s = "new "/*nonNLS*/ + type.toString(0); + String s = "new " + type.toString(0); for (int i = 0 ; i < dimensions.length ; i++) { if (dimensions[i] == null) - s = s + "[]"/*nonNLS*/; + s = s + "[]"; else - s = s + "["/*nonNLS*/ + dimensions[i].toStringExpression() + "]"/*nonNLS*/ ;} + s = s + "[" + dimensions[i].toStringExpression() + "]" ;} if (initializer != null) s = s + initializer.toStringExpression(); return s;}
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java index 3a24fb1..4081696 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java
@@ -139,15 +139,15 @@ public String toStringExpression() { /* slow code */ - String s = "{"/*nonNLS*/ ; + String s = "{" ; if (expressions != null) { int j = 20 ; for (int i = 0 ; i < expressions.length ; i++) - { s = s + expressions[i].toStringExpression() + ","/*nonNLS*/ ; + { s = s + expressions[i].toStringExpression() + "," ; j -- ; if (j == 0) - { s = s + "\n "/*nonNLS*/; j = 20;}}}; - s = s + "}"/*nonNLS*/; + { s = s + "\n "; j = 20;}}}; + s = s + "}"; return s;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java index 7553690..b8177bb 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java
@@ -30,9 +30,9 @@ /* slow speed */ String s = super.toStringExpression(tab) ; - if (dimensions == 1 ) return s + "[]"/*nonNLS*/ ; + if (dimensions == 1 ) return s + "[]" ; for (int i=1 ; i <= dimensions ; i++) - s = s + "[]"/*nonNLS*/ ; + s = s + "[]" ; return s ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java index e3491a0..718b857 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java
@@ -122,9 +122,9 @@ /* slow code */ return receiver.toStringExpression() - + "["/*nonNLS*/ + + "[" + position.toStringExpression() - + "]"/*nonNLS*/ ;} + + "]" ;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) { receiver.traverse(visitor, scope);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java index 6776245..54fc252 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java
@@ -35,9 +35,9 @@ /* slow speed */ String s = super.toStringExpression(tab) ; - if (dimensions == 1 ) return s + "[]"/*nonNLS*/ ; + if (dimensions == 1 ) return s + "[]" ; for (int i=1 ; i <= dimensions ; i++) - s = s + "[]"/*nonNLS*/ ; + s = s + "[]" ; return s ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java index 1d142c9..53cdb72 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java
@@ -101,15 +101,15 @@ //subclass redefine toStringExpressionNoParenthesis() - return "("/*nonNLS*/ + toStringExpressionNoParenthesis() + ")"/*nonNLS*/; } + return "(" + toStringExpressionNoParenthesis() + ")"; } public String toStringExpressionNoParenthesis() { - return lhs.toStringExpression() + " "/*nonNLS*/ + - "="/*nonNLS*/ + + return lhs.toStringExpression() + " " + + "=" + ( (expression.constant != null ) && (expression.constant != NotAConstant) ? - " /*cst:"/*nonNLS*/+expression.constant.toString()+"*/ "/*nonNLS*/ : - " "/*nonNLS*/ ) + + " /*cst:"+expression.constant.toString()+"*/ " : + " " ) + expression.toStringExpression() ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/AstNode.java b/compiler/org/eclipse/jdt/internal/compiler/ast/AstNode.java index c7ce48f..b3ec1ad 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/AstNode.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/AstNode.java
@@ -63,27 +63,27 @@ } public static String modifiersString(int modifiers) { - String s = ""/*nonNLS*/; + String s = ""; if ((modifiers & AccPublic) != 0) - s = s + "public "/*nonNLS*/; + s = s + "public "; if ((modifiers & AccPrivate) != 0) - s = s + "private "/*nonNLS*/; + s = s + "private "; if ((modifiers & AccProtected) != 0) - s = s + "protected "/*nonNLS*/; + s = s + "protected "; if ((modifiers & AccStatic) != 0) - s = s + "static "/*nonNLS*/; + s = s + "static "; if ((modifiers & AccFinal) != 0) - s = s + "final "/*nonNLS*/; + s = s + "final "; if ((modifiers & AccSynchronized) != 0) - s = s + "synchronized "/*nonNLS*/; + s = s + "synchronized "; if ((modifiers & AccVolatile) != 0) - s = s + "volatile "/*nonNLS*/; + s = s + "volatile "; if ((modifiers & AccTransient) != 0) - s = s + "transient "/*nonNLS*/; + s = s + "transient "; if ((modifiers & AccNative) != 0) - s = s + "native "/*nonNLS*/; + s = s + "native "; if ((modifiers & AccAbstract) != 0) - s = s + "abstract "/*nonNLS*/; + s = s + "abstract "; return s; } /** @Deprecated @@ -97,8 +97,8 @@ public static String tabString(int tab){ /*slow code*/ - String s = ""/*nonNLS*/ ; - for (int i = tab ; i > 0 ; i--) s = s + " "/*nonNLS*/ ; + String s = "" ; + for (int i = tab ; i > 0 ; i--) s = s + " " ; return s;} public String toString() { /* low speed */ @@ -109,7 +109,7 @@ /* low speed */ /*If reach here fetchs the default display*/ - return "****"/*nonNLS*/+ super.toString()+ "****"/*nonNLS*/;} + return "****"+ super.toString()+ "****";} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope){ } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java index c3d772b..72eea31 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java
@@ -1402,8 +1402,8 @@ public String toStringExpressionNoParenthesis(){ /* slow code*/ - return left.toStringExpression() + " "/*nonNLS*/ + - operatorToString() + " "/*nonNLS*/ + + return left.toStringExpression() + " " + + operatorToString() + " " + right.toStringExpression() ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Block.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Block.java index 2443f2b..e104220 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Block.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Block.java
@@ -86,9 +86,9 @@ String s = tabString(tab); if (this.statements == null) { - s += "{\n"/*nonNLS*/; + s += "{\n"; s += tabString(tab); - s += "}"/*nonNLS*/; + s += "}"; return s; } @@ -96,22 +96,22 @@ // ? " { // ---scope needed for "+String.valueOf(explicitDeclarations) +" locals------------ \n" // : "{// ---NO scope needed------ \n") ; - s += "{\n"/*nonNLS*/; + s += "{\n"; s += this.toStringStatements(tab); s += tabString(tab); - s += "}"/*nonNLS*/; + s += "}"; return s; } public String toStringStatements(int tab) { /* slow code */ - if (this.statements == null) return ""/*nonNLS*/; + if (this.statements == null) return ""; StringBuffer buffer = new StringBuffer(); for (int i = 0; i < statements.length; i++) { buffer.append(statements[i].toString(tab + 1)); if (statements[i] instanceof Block){ - buffer.append("\n"/*nonNLS*/); + buffer.append("\n"); } else { - buffer.append(";\n"/*nonNLS*/); + buffer.append(";\n"); } }; return buffer.toString();
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Break.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Break.java index 1a1786e..ceefd20 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Break.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Break.java
@@ -65,7 +65,7 @@ /* slow code */ String s = tabString(tab) ; - s = s + "break "/*nonNLS*/; + s = s + "break "; if (label != null ) s = s + new String(label) ; return s;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Case.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Case.java index fadea5a..a1c0351 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Case.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Case.java
@@ -68,7 +68,7 @@ /* slow code */ String s = tabString(tab); - s = s + "case "/*nonNLS*/ + constantExpression.toStringExpression() + " : "/*nonNLS*/ ; + s = s + "case " + constantExpression.toStringExpression() + " : " ; return s;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java index 6ceaa8d..7c9db66 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java
@@ -234,7 +234,7 @@ public String toStringExpression(){ /*slow code*/ - return "("/*nonNLS*/ + type.toString(0)+ ") "/*nonNLS*/ + + return "(" + type.toString(0)+ ") " + expression.toStringExpression() ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java index 4521446..5f53863 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java
@@ -59,8 +59,8 @@ public String toStringExpression(){ /*slow code*/ - String s = ""/*nonNLS*/; - s = s + type.toString(0) + ".class"/*nonNLS*/ ; + String s = ""; + s = s + type.toString(0) + ".class" ; return s;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java index a8ff9ec..0d41feb 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java
@@ -14,7 +14,7 @@ import org.eclipse.jdt.internal.compiler.problem.*; public class Clinit extends AbstractMethodDeclaration { - public final static char[] ConstantPoolName = "<clinit>"/*nonNLS*/.toCharArray(); + public final static char[] ConstantPoolName = "<clinit>".toCharArray(); public Clinit() { modifiers = 0; selector = ConstantPoolName; @@ -137,9 +137,9 @@ public String toString(int tab){ /* slow code */ - String s = ""/*nonNLS*/ ; + String s = "" ; s = s + tabString(tab); - s = s + "<clinit>()"/*nonNLS*/ ; + s = s + "<clinit>()" ; s = s + toStringStatements(tab + 1); return s ;} public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope classScope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java index 5fe113f..8f281d8 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
@@ -197,18 +197,18 @@ public String toString(int tab) { /*very slow code*/ - String s = ""/*nonNLS*/; + String s = ""; if (currentPackage != null) - s = tabString(tab) + "package "/*nonNLS*/ + currentPackage.toString(0, false) + ";\n"/*nonNLS*/; + s = tabString(tab) + "package " + currentPackage.toString(0, false) + ";\n"; if (imports != null) for (int i = 0; i < imports.length; i++) { - s += tabString(tab) + "import "/*nonNLS*/ + imports[i].toString() + ";\n"/*nonNLS*/; + s += tabString(tab) + "import " + imports[i].toString() + ";\n"; }; if (types != null) for (int i = 0; i < types.length; i++) { - s += types[i].toString(tab) + "\n"/*nonNLS*/; + s += types[i].toString(tab) + "\n"; } return s; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java b/compiler/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java index 8f3df73..1d359f0 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java
@@ -48,29 +48,29 @@ public String operatorToString() { switch (operator) { case PLUS : - return "+="/*nonNLS*/; + return "+="; case MINUS : - return "-="/*nonNLS*/; + return "-="; case MULTIPLY : - return "*="/*nonNLS*/; + return "*="; case DIVIDE : - return "/="/*nonNLS*/; + return "/="; case AND : - return "&="/*nonNLS*/; + return "&="; case OR : - return "|="/*nonNLS*/; + return "|="; case XOR : - return "^="/*nonNLS*/; + return "^="; case REMAINDER : - return "%="/*nonNLS*/; + return "%="; case LEFT_SHIFT : - return "<<="/*nonNLS*/; + return "<<="; case RIGHT_SHIFT : - return ">>="/*nonNLS*/; + return ">>="; case UNSIGNED_RIGHT_SHIFT : - return ">>>="/*nonNLS*/; + return ">>>="; }; - return "unknown operator"/*nonNLS*/; + return "unknown operator"; } public TypeBinding resolveType(BlockScope scope) { constant = NotAConstant; @@ -119,8 +119,8 @@ return false ;} public String toStringExpressionNoParenthesis() { - return lhs.toStringExpression() + " "/*nonNLS*/ + - operatorToString() + " "/*nonNLS*/ + + return lhs.toStringExpression() + " " + + operatorToString() + " " + expression.toStringExpression() ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java index da05963..05e9d3c 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
@@ -26,18 +26,17 @@ sourceEnd = valueIfFalse.sourceEnd; } public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { - Constant inlinedCondition = condition.constant; - if (inlinedCondition == NotAConstant) inlinedCondition = condition.conditionalConstant(); - if (inlinedCondition != NotAConstant) { - if (inlinedCondition.booleanValue() == true) { + Constant inlinedCondition; + if ((inlinedCondition = condition.constant) != NotAConstant) { + if (inlinedCondition.booleanValue()) { FlowInfo resultInfo = valueIfTrue.analyseCode(currentScope, flowContext, flowInfo); // analyse valueIfFalse, but do not take into account any of its infos - valueIfFalse.analyseCode(currentScope, flowContext, flowInfo.copy().markAsFakeReachable(true)); + valueIfFalse.analyseCode(currentScope, flowContext, flowInfo.copy()); mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(resultInfo); return resultInfo; } else { // analyse valueIfTrue, but do not take into account any of its infos - valueIfTrue.analyseCode(currentScope, flowContext, flowInfo.copy().markAsFakeReachable(true)); + valueIfTrue.analyseCode(currentScope, flowContext, flowInfo.copy()); FlowInfo mergeInfo = valueIfFalse.analyseCode(currentScope, flowContext, flowInfo); mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergeInfo); return mergeInfo; @@ -254,8 +253,8 @@ public String toStringExpressionNoParenthesis(){ /* slow code*/ - return condition.toStringExpression() + " ? "/*nonNLS*/ + - valueIfTrue.toStringExpression() + " : "/*nonNLS*/ + + return condition.toStringExpression() + " ? " + + valueIfTrue.toStringExpression() + " : " + valueIfFalse.toStringExpression() ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java index 78f8785..e67902b 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
@@ -15,7 +15,7 @@ public class ConstructorDeclaration extends AbstractMethodDeclaration { public ExplicitConstructorCall constructorCall; - public final static char[] ConstantPoolName = "<init>"/*nonNLS*/.toCharArray(); + public final static char[] ConstantPoolName = "<init>".toCharArray(); public boolean isDefaultConstructor = false; public int referenceCount = 0; // count how many times this constructor is referenced from other local constructors @@ -257,19 +257,19 @@ public String toStringStatements(int tab) { /* slow code */ - String s = " {"/*nonNLS*/; + String s = " {"; if (constructorCall != null) { - s = s + "\n"/*nonNLS*/ + constructorCall.toString(tab) + ";"/*nonNLS*/; + s = s + "\n" + constructorCall.toString(tab) + ";"; } if (statements != null){ for (int i = 0; i < statements.length; i++){ - s = s + "\n"/*nonNLS*/ + statements[i].toString(tab); + s = s + "\n" + statements[i].toString(tab); if (!(statements[i] instanceof Block)){ - s += ";"/*nonNLS*/; + s += ";"; } } } - s+="\n"/*nonNLS*/+tabString(tab == 0 ? 0 : tab - 1)+"}"/*nonNLS*/; + s+="\n"+tabString(tab == 0 ? 0 : tab - 1)+"}"; return s; } public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope classScope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Continue.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Continue.java index 56b5dd7..8ab51b8 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Continue.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Continue.java
@@ -69,7 +69,7 @@ /* slow code */ String s = tabString(tab) ; - s = s + "continue "/*nonNLS*/; + s = s + "continue "; if (label != null ) s = s + new String(label) ; return s;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/DefaultCase.java b/compiler/org/eclipse/jdt/internal/compiler/ast/DefaultCase.java index b691359..d2350db 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/DefaultCase.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/DefaultCase.java
@@ -53,7 +53,7 @@ /* slow code */ String s = tabString(tab); - s = s + "default : "/*nonNLS*/ ; + s = s + "default : " ; return s;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { visitor.visit(this, blockScope);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java index f69a0ba..2332f56 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
@@ -125,15 +125,15 @@ String inFront, s = tabString(tab); inFront = s; - s = s + "do"/*nonNLS*/; + s = s + "do"; if (action == null) - s = s + " {}\n"/*nonNLS*/; + s = s + " {}\n"; else if (action instanceof Block) - s = s + "\n"/*nonNLS*/ + action.toString(tab + 1) + "\n"/*nonNLS*/; + s = s + "\n" + action.toString(tab + 1) + "\n"; else - s = s + " {\n"/*nonNLS*/ + action.toString(tab + 1) + ";}\n"/*nonNLS*/; - s = s + inFront + "while ("/*nonNLS*/ + condition.toStringExpression() + ")"/*nonNLS*/; + s = s + " {\n" + action.toString(tab + 1) + ";}\n"; + s = s + inFront + "while (" + condition.toStringExpression() + ")"; return s; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java index 8df5881..f2f6dab 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
@@ -168,9 +168,6 @@ // qualification should be from the type of the enclosingType if (qualification != null) { - if (accessMode != Super){ - scope.problemReporter().unnecessaryEnclosingInstanceSpecification(qualification, receiverType); - } ReferenceBinding enclosingType = receiverType.enclosingType(); if (enclosingType == null) { scope.problemReporter().unnecessaryEnclosingInstanceSpecification(qualification, receiverType); @@ -224,17 +221,17 @@ String s = tabString(tab); if (qualification != null) - s = s + qualification.toStringExpression() + "."/*nonNLS*/ ; + s = s + qualification.toStringExpression() + "." ; if (accessMode == This){ - s = s + "this("/*nonNLS*/; + s = s + "this("; } else { - s = s + "super("/*nonNLS*/; + s = s + "super("; } if (arguments != null) for (int i=0 ; i < arguments.length ; i++) { s = s + arguments[i].toStringExpression(); - if (i != arguments.length-1) s = s + ", "/*nonNLS*/;};; - s = s+")"/*nonNLS*/ ; + if (i != arguments.length-1) s = s + ", ";};; + s = s+")" ; return s;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java index 8595400..ba09480 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
@@ -10,7 +10,6 @@ import org.eclipse.jdt.internal.compiler.flow.*; import org.eclipse.jdt.internal.compiler.lookup.*; import org.eclipse.jdt.internal.compiler.problem.*; -import org.eclipse.jdt.internal.compiler.util.Util; public abstract class Expression extends Statement { //some expression may not be used - from a java semantic point @@ -155,7 +154,7 @@ codeStream.recordPositionsFrom(pc, this); } else { // actual non-constant code generation - throw new ShouldNotImplement(Util.bind("ast.missingCode"/*nonNLS*/)); + throw new ShouldNotImplement("Missing code gen implementation"); } } /** @@ -344,7 +343,7 @@ //before TC has runned if (constant != NotAConstant) //after the TC has runned - s += " /*cst:"/*nonNLS*/ + constant.toString() + "*/ "/*nonNLS*/; + s += " /*cst:" + constant.toString() + "*/ "; return s + toStringExpression(tab); } public String toStringExpression() {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ExtendedStringLiteral.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ExtendedStringLiteral.java index be9c90d..cce2fe0 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ExtendedStringLiteral.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ExtendedStringLiteral.java
@@ -46,7 +46,7 @@ public String toStringExpression() { /* slow code */ - String str = "ExtendedStringLiteral{"/*nonNLS*/+ new String(source) +"}"/*nonNLS*/; + String str = "ExtendedStringLiteral{"+ new String(source) +"}"; return str; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java index 144cdec..694ddb5 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
@@ -365,7 +365,7 @@ /* slow code */ return receiver.toString() - + "."/*nonNLS*/ + + "." + new String(token);} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java index 37e6887..24eff62 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java
@@ -50,10 +50,11 @@ preCondInitStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo); // process the condition - LoopingFlowContext condLoopContext = null; if (condition != null) { if ((condition.constant == NotAConstant) || (condition.constant.booleanValue() != true)) { + LoopingFlowContext condLoopContext; flowInfo = condition.analyseCode(scope, (condLoopContext = new LoopingFlowContext(flowContext, this, null, null, scope)), flowInfo); + condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo); } } @@ -61,7 +62,6 @@ LoopingFlowContext loopingContext; FlowInfo actionInfo; if ((action == null) || action.isEmptyBlock()) { - if (condLoopContext != null) condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo); if ((condition == null) || ((condition.constant != NotAConstant) && (condition.constant.booleanValue() == true))) { return FlowInfo.DeadEnd; } else { @@ -80,11 +80,13 @@ initsWhenTrue.copy()); // code generation can be optimized when no need to continue in the loop - if (((actionInfo == FlowInfo.DeadEnd) || actionInfo.isFakeReachable()) - && ((loopingContext.initsOnContinue == FlowInfo.DeadEnd) || loopingContext.initsOnContinue.isFakeReachable())){ + if ((actionInfo == FlowInfo.DeadEnd) || actionInfo.isFakeReachable()){ + if ((loopingContext.initsOnContinue == FlowInfo.DeadEnd) || loopingContext.initsOnContinue.isFakeReachable()){ continueLabel = null; + } else { + loopingContext.complainOnFinalAssignmentsInLoop(scope, loopingContext.initsOnContinue); + } } else { - if (condLoopContext != null) condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo); loopingContext.complainOnFinalAssignmentsInLoop(scope, actionInfo); actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue.unconditionalInits()); // for increments } @@ -208,32 +210,32 @@ public String toString(int tab ){ /* slow code */ - String s = tabString(tab) + "for ("/*nonNLS*/; + String s = tabString(tab) + "for ("; if (!neededScope) - s = s + " //--NO upperscope scope needed\n"/*nonNLS*/ + tabString(tab) + " "/*nonNLS*/ ; + s = s + " //--NO upperscope scope needed\n" + tabString(tab) + " " ; //inits if (initializations != null) { for (int i = 0 ; i < initializations.length ; i++){ //nice only with expressions s = s + initializations[i].toString(0); - if (i != (initializations.length -1)) s = s + " , "/*nonNLS*/ ;}}; - s = s + "; "/*nonNLS*/ ; + if (i != (initializations.length -1)) s = s + " , " ;}}; + s = s + "; " ; //cond if (condition != null) s = s + condition.toStringExpression() ; - s = s + "; "/*nonNLS*/ ; + s = s + "; " ; //updates if (increments != null) { for (int i = 0 ; i < increments.length ; i++){ //nice only with expressions s = s + increments[i].toString(0); - if (i != (increments.length -1)) s = s + " , "/*nonNLS*/ ;}}; - s = s + ") "/*nonNLS*/ ; + if (i != (increments.length -1)) s = s + " , " ;}}; + s = s + ") " ; //block if (action == null) - s = s + "{}"/*nonNLS*/ ; + s = s + "{}" ; else - s = s + "\n"/*nonNLS*/+ action.toString(tab+1) ; + s = s + "\n"+ action.toString(tab+1) ; return s;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java index 48a5d34..50c2741 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java
@@ -187,10 +187,10 @@ String inFront , s = tabString(tab) ; inFront = s ; - s = s + "if ("/*nonNLS*/+ condition.toStringExpression()+") \n"/*nonNLS*/; - s = s + thenStatement.toString(tab+2) + ";"/*nonNLS*/ ; + s = s + "if ("+ condition.toStringExpression()+") \n"; + s = s + thenStatement.toString(tab+2) + ";" ; if (elseStatement != null) - s = s + "\n"/*nonNLS*/ + inFront + "else\n"/*nonNLS*/ + elseStatement.toString(tab+2) + ";"/*nonNLS*/; + s = s + "\n" + inFront + "else\n" + elseStatement.toString(tab+2) + ";"; return s ;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java index af82fee..0114957 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java
@@ -38,11 +38,11 @@ for (int i = 0; i < tokens.length; i++) { buffer.append(tokens[i]); if (i < (tokens.length - 1)) { - buffer.append("."/*nonNLS*/); + buffer.append("."); } } if (withOnDemand && onDemand) { - buffer.append(".*"/*nonNLS*/); + buffer.append(".*"); } return buffer.toString(); }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java index b796c10..0f27528 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java
@@ -72,10 +72,10 @@ StringBuffer buffer = new StringBuffer(); buffer.append(tabString(tab)); buffer.append(modifiersString(modifiers)); - buffer.append("{\n"/*nonNLS*/); + buffer.append("{\n"); buffer.append(block.toStringStatements(tab)); buffer.append(tabString(tab)); - buffer.append("}"/*nonNLS*/); + buffer.append("}"); return buffer.toString(); } else { return block.toString(tab);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java index fbf019b..ec16729 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
@@ -199,7 +199,8 @@ public String toStringExpressionNoParenthesis(){ /* slow code*/ - return expression.toStringExpression() + " instanceof "/*nonNLS*/ + + if (((bits & OperatorMASK) >> OperatorSHIFT) != INSTANCEOF ) return "houps instanceof houps" ; + return expression.toStringExpression() + " instanceof " + type.toString(0) ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java index 436ded9..f94c515 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java
@@ -77,7 +77,7 @@ /* slow code */ String s = tabString(tab); - s += new String(label) + ": "/*nonNLS*/ + statement.toString(0); + s += new String(label) + ": " + statement.toString(0); return s; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/MagicLiteral.java b/compiler/org/eclipse/jdt/internal/compiler/ast/MagicLiteral.java index 6c063d0..c615ce0 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/MagicLiteral.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/MagicLiteral.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.ast; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public abstract class MagicLiteral extends Literal { public MagicLiteral(int s , int e) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java index 656ea2a..683e9d0 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
@@ -239,15 +239,15 @@ public String toStringExpression(){ /*slow code*/ - String s = ""/*nonNLS*/; + String s = ""; if (receiver != ThisReference.ThisImplicit) - s = s + receiver.toStringExpression()+"."/*nonNLS*/; - s = s + new String(selector) + "("/*nonNLS*/ ; + s = s + receiver.toStringExpression()+"."; + s = s + new String(selector) + "(" ; if (arguments != null) for (int i = 0; i < arguments.length ; i ++) { s = s + arguments[i].toStringExpression(); - if ( i != arguments.length -1 ) s = s + " , "/*nonNLS*/ ;};; - s =s + ")"/*nonNLS*/ ; + if ( i != arguments.length -1 ) s = s + " , " ;};; + s =s + ")" ; return s;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java b/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java index 4fa13eb..c1a161d 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
@@ -70,8 +70,8 @@ /*slow code */ if (returnType == null) - return ""/*nonNLS*/; - return returnType.toString(tab)+" "/*nonNLS*/; + return ""; + return returnType.toString(tab)+" "; } public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope classScope) { if (visitor.visit(this, classScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java b/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java index b995f82..65c8d8c 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.ast; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public abstract class NumberLiteral extends Literal { char[] source;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java index 2b674f6..029b843 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java
@@ -53,80 +53,80 @@ class Decode { public final String constant(int code){ switch(code){ - case T_boolean : return "true"/*nonNLS*/ ; - case T_byte : return "((byte) 3)"/*nonNLS*/ ; - case T_char : return "'A'"/*nonNLS*/ ; - case T_double : return "300.0d"/*nonNLS*/ ; - case T_float : return "100.0f"/*nonNLS*/ ; - case T_int : return "1"/*nonNLS*/ ; - case T_long : return "7L"/*nonNLS*/ ; - case T_String : return "\"hello-world\""/*nonNLS*/ ; - case T_null : return "null"/*nonNLS*/; - case T_short : return "((short) 5)"/*nonNLS*/; - case T_Object : return "null"/*nonNLS*/;} - return ""/*nonNLS*/;} + case T_boolean : return "true" ; + case T_byte : return "((byte) 3)" ; + case T_char : return "'A'" ; + case T_double : return "300.0d" ; + case T_float : return "100.0f" ; + case T_int : return "1" ; + case T_long : return "7L" ; + case T_String : return "\"hello-world\"" ; + case T_null : return "null"; + case T_short : return "((short) 5)"; + case T_Object : return "null";} + return "";} public final String type(int code){ switch(code){ - case T_boolean : return "z"/*nonNLS*/ ; - case T_byte : return "b"/*nonNLS*/ ; - case T_char : return "c"/*nonNLS*/ ; - case T_double : return "d"/*nonNLS*/ ; - case T_float : return "f"/*nonNLS*/ ; - case T_int : return "i"/*nonNLS*/ ; - case T_long : return "l"/*nonNLS*/ ; - case T_String : return "str"/*nonNLS*/ ; - case T_null : return "null"/*nonNLS*/; - case T_short : return "s"/*nonNLS*/; - case T_Object : return "obj"/*nonNLS*/;} - return "xxx"/*nonNLS*/;} + case T_boolean : return "z" ; + case T_byte : return "b" ; + case T_char : return "c" ; + case T_double : return "d" ; + case T_float : return "f" ; + case T_int : return "i" ; + case T_long : return "l" ; + case T_String : return "str" ; + case T_null : return "null"; + case T_short : return "s"; + case T_Object : return "obj";} + return "xxx";} public final String operator(int operator){ switch (operator) { - case EQUAL_EQUAL : return "=="/*nonNLS*/; - case LESS_EQUAL : return "<="/*nonNLS*/; - case GREATER_EQUAL :return ">="/*nonNLS*/; - case LEFT_SHIFT : return "<<"/*nonNLS*/; - case RIGHT_SHIFT : return ">>"/*nonNLS*/; - case UNSIGNED_RIGHT_SHIFT : return ">>>"/*nonNLS*/; - case OR_OR :return "||"/*nonNLS*/; - case AND_AND : return "&&"/*nonNLS*/; - case PLUS : return "+"/*nonNLS*/; - case MINUS : return "-"/*nonNLS*/; - case NOT : return "!"/*nonNLS*/; - case REMAINDER : return "%"/*nonNLS*/; - case XOR : return "^"/*nonNLS*/; - case AND : return "&"/*nonNLS*/; - case MULTIPLY : return "*"/*nonNLS*/; - case OR : return "|"/*nonNLS*/; - case TWIDDLE : return "~"/*nonNLS*/; - case DIVIDE : return "/"/*nonNLS*/; - case GREATER : return ">"/*nonNLS*/; - case LESS : return "<"/*nonNLS*/; }; - return "????"/*nonNLS*/;} + case EQUAL_EQUAL : return "=="; + case LESS_EQUAL : return "<="; + case GREATER_EQUAL :return ">="; + case LEFT_SHIFT : return "<<"; + case RIGHT_SHIFT : return ">>"; + case UNSIGNED_RIGHT_SHIFT : return ">>>"; + case OR_OR :return "||"; + case AND_AND : return "&&"; + case PLUS : return "+"; + case MINUS : return "-"; + case NOT : return "!"; + case REMAINDER : return "%"; + case XOR : return "^"; + case AND : return "&"; + case MULTIPLY : return "*"; + case OR : return "|"; + case TWIDDLE : return "~"; + case DIVIDE : return "/"; + case GREATER : return ">"; + case LESS : return "<"; }; + return "????";} } Decode decode = new Decode(); String s ; - s = "\tpublic static void binaryOperationTablesTestCase(){\n"/*nonNLS*/ + + s = "\tpublic static void binaryOperationTablesTestCase(){\n" + - "\t\t//TC test : all binary operation (described in tables)\n"/*nonNLS*/+ - "\t\t//method automatically generated by\n"/*nonNLS*/+ - "\t\t//org.eclipse.jdt.internal.compiler.ast.OperatorExpression.generateTableTestCase();\n"/*nonNLS*/+ + "\t\t//TC test : all binary operation (described in tables)\n"+ + "\t\t//method automatically generated by\n"+ + "\t\t//org.eclipse.jdt.internal.compiler.ast.OperatorExpression.generateTableTestCase();\n"+ - "\t\tString str0 ;\t String str\t= "/*nonNLS*/+decode.constant(T_String)+";\n"/*nonNLS*/+ - "\t\tint i0 ;\t int i\t= "/*nonNLS*/+decode.constant(T_int)+" ;\n"/*nonNLS*/+ - "\t\tboolean z0;\t boolean z\t= "/*nonNLS*/+decode.constant(T_boolean)+";\n"/*nonNLS*/+ - "\t\tchar c0; \t char c\t= "/*nonNLS*/+decode.constant(T_char)+" ;\n"/*nonNLS*/+ - "\t\tfloat f0; \t float f\t= "/*nonNLS*/+decode.constant(T_float)+" ;\n"/*nonNLS*/+ - "\t\tdouble d0;\t double d\t= "/*nonNLS*/+decode.constant(T_double)+" ;\n"/*nonNLS*/+ - "\t\tbyte b0; \t byte b\t= "/*nonNLS*/+decode.constant(T_byte)+";\n"/*nonNLS*/+ - "\t\tshort s0; \t short s\t= "/*nonNLS*/+decode.constant(T_short)+";\n"/*nonNLS*/+ - "\t\tlong l0; \t long l\t= "/*nonNLS*/+decode.constant(T_long)+" ;\n"/*nonNLS*/+ - "\t\tObject obj0; \t Object obj\t= "/*nonNLS*/+decode.constant(T_Object)+" ;\n"/*nonNLS*/+ + "\t\tString str0 ;\t String str\t= "+decode.constant(T_String)+";\n"+ + "\t\tint i0 ;\t int i\t= "+decode.constant(T_int)+" ;\n"+ + "\t\tboolean z0;\t boolean z\t= "+decode.constant(T_boolean)+";\n"+ + "\t\tchar c0; \t char c\t= "+decode.constant(T_char)+" ;\n"+ + "\t\tfloat f0; \t float f\t= "+decode.constant(T_float)+" ;\n"+ + "\t\tdouble d0;\t double d\t= "+decode.constant(T_double)+" ;\n"+ + "\t\tbyte b0; \t byte b\t= "+decode.constant(T_byte)+";\n"+ + "\t\tshort s0; \t short s\t= "+decode.constant(T_short)+";\n"+ + "\t\tlong l0; \t long l\t= "+decode.constant(T_long)+" ;\n"+ + "\t\tObject obj0; \t Object obj\t= "+decode.constant(T_Object)+" ;\n"+ - "\n"/*nonNLS*/; + "\n"; int error = 0; for (int i=0; i < operators.length ; i++) @@ -142,19 +142,19 @@ // if ( z0 != (((short) 5) >= ((short) 5))) // System.out.println(155); - { s += "\t\t"/*nonNLS*/+decode.type(result)+"0"/*nonNLS*/+" = "/*nonNLS*/+decode.type(left); - s += " "/*nonNLS*/+decode.operator(operator)+" "/*nonNLS*/+decode.type(right)+";\n"/*nonNLS*/; - String begin = result == T_String ? "\t\tif (! "/*nonNLS*/ : "\t\tif ( "/*nonNLS*/; - String test = result == T_String ? ".equals("/*nonNLS*/ : " != ("/*nonNLS*/ ; - s += begin +decode.type(result)+"0"/*nonNLS*/+test - +decode.constant(left)+" "/*nonNLS*/ - +decode.operator(operator)+" "/*nonNLS*/ - +decode.constant(right)+"))\n"/*nonNLS*/; - s += "\t\t\tSystem.out.println("/*nonNLS*/+ (++error) +");\n"/*nonNLS*/; + { s += "\t\t"+decode.type(result)+"0"+" = "+decode.type(left); + s += " "+decode.operator(operator)+" "+decode.type(right)+";\n"; + String begin = result == T_String ? "\t\tif (! " : "\t\tif ( "; + String test = result == T_String ? ".equals(" : " != (" ; + s += begin +decode.type(result)+"0"+test + +decode.constant(left)+" " + +decode.operator(operator)+" " + +decode.constant(right)+"))\n"; + s += "\t\t\tSystem.out.println("+ (++error) +");\n"; }}} - return s += "\n\t\tSystem.out.println(\"binary tables test : done\");}"/*nonNLS*/ ; + return s += "\n\t\tSystem.out.println(\"binary tables test : done\");}" ; } public static final int[] get_AND(){ @@ -1539,62 +1539,61 @@ public String operatorToString() { switch ((bits & OperatorMASK) >> OperatorSHIFT) { case EQUAL_EQUAL : - return "=="/*nonNLS*/; + return "=="; case LESS_EQUAL : - return "<="/*nonNLS*/; + return "<="; case GREATER_EQUAL : - return ">="/*nonNLS*/; + return ">="; case NOT_EQUAL : - return "!="/*nonNLS*/; + return "!="; case LEFT_SHIFT : - return "<<"/*nonNLS*/; + return "<<"; case RIGHT_SHIFT : - return ">>"/*nonNLS*/; + return ">>"; case UNSIGNED_RIGHT_SHIFT : - return ">>>"/*nonNLS*/; + return ">>>"; case OR_OR : - return "||"/*nonNLS*/; + return "||"; case AND_AND : - return "&&"/*nonNLS*/; + return "&&"; case PLUS : - return "+"/*nonNLS*/; + return "+"; case MINUS : - return "-"/*nonNLS*/; + return "-"; case NOT : - return "!"/*nonNLS*/; + return "!"; case REMAINDER : - return "%"/*nonNLS*/; + return "%"; case XOR : - return "^"/*nonNLS*/; + return "^"; case AND : - return "&"/*nonNLS*/; + return "&"; case MULTIPLY : - return "*"/*nonNLS*/; + return "*"; case OR : - return "|"/*nonNLS*/; + return "|"; case TWIDDLE : - return "~"/*nonNLS*/; + return "~"; case DIVIDE : - return "/"/*nonNLS*/; + return "/"; case GREATER : - return ">"/*nonNLS*/; + return ">"; case LESS : - return "<"/*nonNLS*/; + return "<"; case QUESTIONCOLON : - return "?:"/*nonNLS*/; + return "?:"; case EQUAL : - return "="/*nonNLS*/; + return "="; }; - return "unknown operator"/*nonNLS*/; + return "unknown operator"; } public String toStringExpression(){ /* slow code*/ //subclass redefine toStringExpressionNoParenthesis() - return "("/*nonNLS*/ + toStringExpressionNoParenthesis() + ")"/*nonNLS*/; -} - -public abstract String toStringExpressionNoParenthesis(); - + return "(" + toStringExpressionNoParenthesis() + ")"; } +public String toStringExpressionNoParenthesis(){ + + return "...houps...";} }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorIds.java b/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorIds.java index c4ca1cc..77dcb2f 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorIds.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorIds.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.ast; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface OperatorIds { public static final int AND_AND = 0;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java index 008c712..5d93416 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java
@@ -39,17 +39,17 @@ public String operatorToString() { switch (operator) { case PLUS : - return "++"/*nonNLS*/; + return "++"; case MINUS : - return "--"/*nonNLS*/;} - return "unknown operator"/*nonNLS*/; + return "--";} + return "unknown operator"; } public boolean restrainUsageToNumericTypes(){ return true ;} public String toStringExpressionNoParenthesis(){ /* slow code*/ - return lhs.toStringExpression() + " "/*nonNLS*/ + operatorToString(); } + return lhs.toStringExpression() + " " + operatorToString(); } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) { lhs.traverse(visitor, scope);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java index 7912487..cd46fca 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java
@@ -23,17 +23,17 @@ public String operatorToString() { switch (operator) { case PLUS : - return "++"/*nonNLS*/; + return "++"; case MINUS : - return "--"/*nonNLS*/;} - return "unknown operator"/*nonNLS*/; + return "--";} + return "unknown operator"; } public boolean restrainUsageToNumericTypes(){ return true ;} public String toStringExpressionNoParenthesis(){ /* slow code */ - return operatorToString() + " "/*nonNLS*/ + lhs.toStringExpression() ; + return operatorToString() + " " + lhs.toStringExpression() ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java index fc7d922..ab5640c 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
@@ -148,13 +148,13 @@ if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null) argHasError = true; if (argHasError) - return recType; + return null; } if (recType == null) return null; if (!recType.canBeInstantiated()) { scope.problemReporter().cannotInstantiate(type, recType); - return recType; + return null; } if ((binding = scope.getConstructor((ReferenceBinding) recType, argumentTypes, this)).isValidBinding()) { if (isMethodUseDeprecated(binding, scope)) @@ -167,7 +167,7 @@ if (binding.declaringClass == null) binding.declaringClass = (ReferenceBinding) recType; scope.problemReporter().invalidConstructor(this, binding); - return recType; + return null; } // The enclosing instance must be compatible with the innermost enclosing type @@ -175,7 +175,7 @@ if (scope.areTypesCompatible(enclosingInstTb, expectedType)) return recType; scope.problemReporter().typeMismatchErrorActualTypeExpectedType(enclosingInstance, enclosingInstTb, expectedType); - return recType; + return null; } //--------------there is an anonymous type declaration----------------- @@ -238,9 +238,9 @@ public String toStringExpression(int tab) { /*slow code */ - String s = ""/*nonNLS*/; + String s = ""; if (enclosingInstance != null) - s += enclosingInstance.toString() + "."/*nonNLS*/; + s += enclosingInstance.toString() + "."; s += super.toStringExpression(tab); if (anonymousType != null) { s += anonymousType.toString(tab);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java index 9114662..8236ae3 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
@@ -597,7 +597,7 @@ for (int i = 0; i < tokens.length; i++) { buffer.append(tokens[i]); if (i < (tokens.length - 1)) { - buffer.append("."/*nonNLS*/); + buffer.append("."); } } return buffer.toString();
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedSuperReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedSuperReference.java index 7b40115..365f0da 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedSuperReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedSuperReference.java
@@ -36,7 +36,7 @@ public String toStringExpression(){ /* slow code */ - return qualification.toString(0)+".super"/*nonNLS*/ ; + return qualification.toString(0)+".super" ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java index 45987d1..9a3c5fd 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java
@@ -119,7 +119,7 @@ public String toStringExpression(){ /* slow code */ - return qualification.toString(0)+".this"/*nonNLS*/ ; + return qualification.toString(0)+".this" ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java index cb2ccca..e80478f 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
@@ -41,7 +41,7 @@ for (int i = 0; i < tokens.length; i++) { buffer.append(tokens[i]); if (i < (tokens.length - 1)) { - buffer.append("."/*nonNLS*/); + buffer.append("."); } } return buffer.toString();
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java index 04a336f..18b1857 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java
@@ -9,7 +9,6 @@ import org.eclipse.jdt.internal.compiler.flow.*; import org.eclipse.jdt.internal.compiler.lookup.*; import org.eclipse.jdt.internal.compiler.problem.*; -import org.eclipse.jdt.internal.compiler.util.Util; public abstract class Reference extends Expression { /** @@ -19,7 +18,7 @@ super(); } public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) { - throw new ShouldNotImplement(Util.bind("ast.variableShouldProvide"/*nonNLS*/)); + throw new ShouldNotImplement("Assignment variable should provide an implementation for flow analysis"); } public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { return flowInfo; @@ -61,13 +60,13 @@ } } public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) { - throw new ShouldNotImplement(Util.bind("ast.compoundPreShouldProvide"/*nonNLS*/)); + throw new ShouldNotImplement("Compound pre assignments should provide an implementation for code generation"); } public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) { - throw new ShouldNotImplement(Util.bind("ast.compoundVariableShouldProvide"/*nonNLS*/)); + throw new ShouldNotImplement("Compound assignment variable should provide an implementation for code generation"); } public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) { - throw new ShouldNotImplement(Util.bind("ast.postIncrShouldProvide"/*nonNLS*/)); + throw new ShouldNotImplement("Post increment variable should provide an implementation for code generation"); } public boolean isFieldReference() {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java index e76ddc8..8931282 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
@@ -225,7 +225,7 @@ /* slow code */ String s = tabString(tab) ; - s = s + "return "/*nonNLS*/; + s = s + "return "; if (expression != null ) s = s + expression.toStringExpression() ; return s;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java index 5060063..f205984 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java
@@ -10,7 +10,6 @@ import org.eclipse.jdt.internal.compiler.flow.*; import org.eclipse.jdt.internal.compiler.lookup.*; import org.eclipse.jdt.internal.compiler.problem.*; -import org.eclipse.jdt.internal.compiler.util.Util; public abstract class Statement extends AstNode { // storage for internal flags (32 bits) @@ -78,7 +77,7 @@ return flowInfo; } public void generateCode(BlockScope currentScope, CodeStream codeStream){ - throw new ShouldNotImplement(Util.bind("ast.missingStatement"/*nonNLS*/)); + throw new ShouldNotImplement("Missing statement code generation implementation"); } public boolean isEmptyBlock(){ return false;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/StringLiteral.java b/compiler/org/eclipse/jdt/internal/compiler/ast/StringLiteral.java index 4f4b257..e2a52ae 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/StringLiteral.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/StringLiteral.java
@@ -57,38 +57,38 @@ public String toStringExpression() { // handle some special char..... - StringBuffer result = new StringBuffer("\""/*nonNLS*/); + StringBuffer result = new StringBuffer("\""); for (int i = 0; i < source.length; i++) { switch (source[i]) { case '\b' : - result.append("\\b"/*nonNLS*/); + result.append("\\b"); break; case '\t' : - result.append("\\t"/*nonNLS*/); + result.append("\\t"); break; case '\n' : - result.append("\\n"/*nonNLS*/); + result.append("\\n"); break; case '\f' : - result.append("\\f"/*nonNLS*/); + result.append("\\f"); break; case '\r' : - result.append("\\r"/*nonNLS*/); + result.append("\\r"); break; case '\"' : - result.append("\\\""/*nonNLS*/); + result.append("\\\""); break; case '\'' : - result.append("\\'"/*nonNLS*/); + result.append("\\'"); break; case '\\' : //take care not to display the escape as a potential real char - result.append("\\\\"/*nonNLS*/); + result.append("\\\\"); break; default : result.append(source[i]); } } - result.append("\""/*nonNLS*/); + result.append("\""); return result.toString(); } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/SuperReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/SuperReference.java index 83e55fe..1626c1e 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/SuperReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/SuperReference.java
@@ -46,7 +46,7 @@ } public String toStringExpression(){ - return "super"/*nonNLS*/; + return "super"; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java index 61c0776..e86ea69 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
@@ -211,41 +211,41 @@ String inFront , s = tabString(tab) ; inFront = s ; - s = s + "switch ("/*nonNLS*/ + testExpression.toStringExpression() + ") "/*nonNLS*/; + s = s + "switch (" + testExpression.toStringExpression() + ") "; if (statements == null) - { s = s + "{}"/*nonNLS*/ ; + { s = s + "{}" ; return s;} else - s = s + "{"/*nonNLS*/; + s = s + "{"; s = s + (explicitDeclarations != 0 - ? "// ---scope needed for "/*nonNLS*/+String.valueOf(explicitDeclarations) +" locals------------ \n"/*nonNLS*/ - : "// ---NO scope needed------ \n"/*nonNLS*/) ; + ? "// ---scope needed for "+String.valueOf(explicitDeclarations) +" locals------------ \n" + : "// ---NO scope needed------ \n") ; int i = 0; - String tabulation = " "/*nonNLS*/; + String tabulation = " "; try {while(true){ //use instanceof in order not to polluate classes with behavior only needed for printing purpose. if ( statements[i] instanceof Expression) - s = s + "\n"/*nonNLS*/ + inFront + tabulation; + s = s + "\n" + inFront + tabulation; if ( statements[i] instanceof Break) s = s + statements[i].toString(0) ; else - s = s + "\n"/*nonNLS*/ + statements[i].toString(tab+2) ; + s = s + "\n" + statements[i].toString(tab+2) ; //============= if ( (statements[i] instanceof Case) || (statements[i] instanceof DefaultCase)) { i++; while(! ((statements[i] instanceof Case) || (statements[i] instanceof DefaultCase))) { if ( (statements[i] instanceof Expression) || (statements[i] instanceof Break)) - s = s + statements[i].toString(0) +" ; "/*nonNLS*/; + s = s + statements[i].toString(0) +" ; "; else - s = s + "\n"/*nonNLS*/ + statements[i].toString(tab+6) + " ; "/*nonNLS*/; + s = s + "\n" + statements[i].toString(tab+6) + " ; "; i++;}} else - { s = s + " ;"/*nonNLS*/ ; + { s = s + " ;" ; i++;}}} catch(IndexOutOfBoundsException e){}; - s = s + "}"/*nonNLS*/; + s = s + "}"; return s;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java index 62b5774..c20d3f7 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java
@@ -17,7 +17,7 @@ boolean blockExit; public LocalVariableBinding synchroVariable; - static final char[] SecretLocalDeclarationName = " syncValue"/*nonNLS*/.toCharArray(); + static final char[] SecretLocalDeclarationName = " syncValue".toCharArray(); public SynchronizedStatement(Expression expression , Block statement, int s, int e) { this.expression = expression; @@ -73,6 +73,7 @@ // generate the body of the synchronized block ExceptionLabel anyExceptionHandler = new ExceptionLabel(codeStream, null); //'null' denotes any kind of exception block.generateCode(scope, codeStream); + anyExceptionHandler.placeEnd(); Label endLabel = new Label(codeStream); if (!blockExit) { codeStream.load(synchroVariable); @@ -80,7 +81,6 @@ codeStream.goto_(endLabel); } // generate the body of the exception handler - anyExceptionHandler.placeEnd(); anyExceptionHandler.place(); codeStream.incrStackSize(1); codeStream.load(synchroVariable); @@ -128,8 +128,8 @@ /* slow code */ String s = tabString(tab) ; - s = s + "synchronized ("/*nonNLS*/ + expression.toStringExpression() + ")"/*nonNLS*/; - s = s + "\n"/*nonNLS*/ + block.toString(tab+1) ; + s = s + "synchronized (" + expression.toStringExpression() + ")"; + s = s + "\n" + block.toString(tab+1) ; return s;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ThisReference.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ThisReference.java index e9cf7e2..1ac7233 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ThisReference.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ThisReference.java
@@ -56,8 +56,8 @@ } public String toStringExpression(){ - if (this == ThisImplicit) return ""/*nonNLS*/ ; - return "this"/*nonNLS*/; + if (this == ThisImplicit) return "" ; + return "this"; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { visitor.visit(this, blockScope);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java index f1adeb7..612a343 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java
@@ -56,7 +56,7 @@ /* slow code */ String s = tabString(tab) ; - s = s + "throw "/*nonNLS*/; + s = s + "throw "; s = s + exception.toStringExpression() ; return s; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java index f2f4815..ae86820 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java
@@ -29,8 +29,8 @@ Label subRoutineStartLabel; LocalVariableBinding anyExceptionVariable, returnAddressVariable; - final static char[] SecretReturnName = " returnAddress"/*nonNLS*/.toCharArray() ; - final static char[] SecretAnyHandlerName = " anyExceptionHandler"/*nonNLS*/.toCharArray(); + final static char[] SecretReturnName = " returnAddress".toCharArray() ; + final static char[] SecretAnyHandlerName = " anyExceptionHandler".toCharArray(); // for local variables table attributes int preTryInitStateIndex = -1; @@ -374,24 +374,24 @@ String s = tabString(tab) ; //try - s = s + "try "/*nonNLS*/ ; + s = s + "try " ; if (tryBlock == Block.None) - s =s + "{}"/*nonNLS*/ ; + s =s + "{}" ; else - s = s + "\n"/*nonNLS*/ + tryBlock.toString(tab+1) ; + s = s + "\n" + tryBlock.toString(tab+1) ; //catches if (catchBlocks != null) for (int i = 0; i < catchBlocks.length ; i++) - s = s + "\n"/*nonNLS*/ + tabString(tab) + "catch ("/*nonNLS*/ - + catchArguments[i].toString(0) + ") "/*nonNLS*/ + s = s + "\n" + tabString(tab) + "catch (" + + catchArguments[i].toString(0) + ") " + catchBlocks[i].toString(tab+1) ; //finally if (finallyBlock != null) { if (finallyBlock == Block.None) - s = s + "\n"/*nonNLS*/ + tabString(tab)+ "finally {}"/*nonNLS*/ ; + s = s + "\n" + tabString(tab)+ "finally {}" ; else - s = s + "\n"/*nonNLS*/ + tabString(tab)+ "finally\n"/*nonNLS*/ + + s = s + "\n" + tabString(tab)+ "finally\n" + finallyBlock.toString(tab+1) ;} return s ;}
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java index 38705e1..d010c05 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
@@ -773,48 +773,48 @@ public String toStringBody(int tab) { /*slow code */ - String s = " {"/*nonNLS*/; + String s = " {"; if (memberTypes != null) { for (int i = 0; i < memberTypes.length; i++) { if (memberTypes[i] != null) { - s += "\n"/*nonNLS*/ + memberTypes[i].toString(tab + 1); + s += "\n" + memberTypes[i].toString(tab + 1); } } } if (fields != null) { for (int fieldI = 0; fieldI < fields.length; fieldI++) { if (fields[fieldI] != null) { - s += "\n"/*nonNLS*/ + fields[fieldI].toString(tab + 1); - if (fields[fieldI].isField()) s += ";"/*nonNLS*/; + s += "\n" + fields[fieldI].toString(tab + 1); + if (fields[fieldI].isField()) s += ";"; } } } if (methods != null) { for (int i = 0; i < methods.length; i++) { if (methods[i] != null) { - s += "\n"/*nonNLS*/ + methods[i].toString(tab + 1); + s += "\n" + methods[i].toString(tab + 1); } } } - s += "\n"/*nonNLS*/+tabString(tab) + "}"/*nonNLS*/; + s += "\n"+tabString(tab) + "}"; return s; } public String toStringHeader() { /*slow code */ - String s = ""/*nonNLS*/; + String s = ""; if (modifiers != AccDefault) { s += modifiersString(modifiers); } - s += (isInterface() ? "interface "/*nonNLS*/ : "class "/*nonNLS*/) + new String(name); + s += (isInterface() ? "interface " : "class ") + new String(name); if (superclass != null) - s += " extends "/*nonNLS*/ + superclass.toString(0); + s += " extends " + superclass.toString(0); if (superInterfaces != null && superInterfaces.length > 0) { - s += (isInterface() ? " extends "/*nonNLS*/ : " implements "/*nonNLS*/); + s += (isInterface() ? " extends " : " implements "); for (int i = 0; i < superInterfaces.length; i++) { s += superInterfaces[i].toString(0); if (i != superInterfaces.length-1) - s += ", "/*nonNLS*/; + s += ", "; }; };
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java index d99021d..0ade10f 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java
@@ -245,7 +245,7 @@ public String toStringExpressionNoParenthesis(){ /* slow code*/ - return operatorToString() + " "/*nonNLS*/ + expression.toStringExpression() ; } + return operatorToString() + " " + expression.toStringExpression() ; } public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) { expression.traverse(visitor, blockScope);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java index b879a0c..71f3882 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java
@@ -35,10 +35,10 @@ currentScope, (condLoopContext = new LoopingFlowContext(flowContext, this, null, null, currentScope)), flowInfo); + condLoopContext.complainOnFinalAssignmentsInLoop(currentScope, postCondInfo); LoopingFlowContext loopingContext; if ((action == null) || action.isEmptyBlock()) { - condLoopContext.complainOnFinalAssignmentsInLoop(currentScope, postCondInfo); if ((condition.constant != NotAConstant) && (condition.constant.booleanValue() == true)) { return FlowInfo.DeadEnd; } else { @@ -63,14 +63,16 @@ } // code generation can be optimized when no need to continue in the loop - if (((actionInfo == FlowInfo.DeadEnd) || actionInfo.isFakeReachable()) - && ((loopingContext.initsOnContinue == FlowInfo.DeadEnd) || loopingContext.initsOnContinue.isFakeReachable())){ + if ((actionInfo == FlowInfo.DeadEnd) || actionInfo.isFakeReachable()){ + if ((loopingContext.initsOnContinue == FlowInfo.DeadEnd) || loopingContext.initsOnContinue.isFakeReachable()){ continueLabel = null; + } else { + loopingContext.complainOnFinalAssignmentsInLoop(currentScope, loopingContext.initsOnContinue); + } } else { - condLoopContext.complainOnFinalAssignmentsInLoop(currentScope, postCondInfo); loopingContext.complainOnFinalAssignmentsInLoop(currentScope, actionInfo); } - } + } // infinite loop FlowInfo mergedInfo; @@ -149,14 +151,14 @@ /* slow code */ String s = tabString(tab) ; - s = s + "while ("/*nonNLS*/ + condition.toStringExpression() + ")"/*nonNLS*/; + s = s + "while (" + condition.toStringExpression() + ")"; if (action == null) - s = s + " {} ;"/*nonNLS*/; + s = s + " {} ;"; else if (action instanceof Block) - s = s + "\n"/*nonNLS*/ + action.toString(tab+1) ; + s = s + "\n" + action.toString(tab+1) ; else - s = s + " {\n"/*nonNLS*/ + action.toString(tab+1) + "}"/*nonNLS*/ ; + s = s + " {\n" + action.toString(tab+1) + "}" ; return s;} public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java b/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java index 1a19a46..f37c03a 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java +++ b/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java
@@ -508,10 +508,10 @@ java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream(); java.io.PrintWriter print = new java.io.PrintWriter(out); - print.println(this.getClass().getName() + "{"/*nonNLS*/); - print.println(" className: "/*nonNLS*/ + new String(getName())); - print.println(" superclassName: "/*nonNLS*/ + (getSuperclassName() == null ? "null"/*nonNLS*/ : new String(getSuperclassName()))); - print.println(" access_flags: "/*nonNLS*/ + ClassFileStruct.printTypeModifiers(accessFlags()) + "("/*nonNLS*/ + accessFlags() + ")"/*nonNLS*/); + print.println(this.getClass().getName() + "{"); + print.println(" className: " + new String(getName())); + print.println(" superclassName: " + (getSuperclassName() == null ? "null" : new String(getSuperclassName()))); + print.println(" access_flags: " + ClassFileStruct.printTypeModifiers(accessFlags()) + "(" + accessFlags() + ")"); print.flush(); return out.toString();
diff --git a/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileStruct.java b/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileStruct.java index 1ff4e1f..0c7316b 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileStruct.java +++ b/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileStruct.java
@@ -1,10 +1,5 @@ package org.eclipse.jdt.internal.compiler.classfmt; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; - + abstract public class ClassFileStruct implements ClassFileConstants { byte[] reference; int structOffset; @@ -114,12 +109,12 @@ java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream(); java.io.PrintWriter print = new java.io.PrintWriter(out); - if ((modifiers & AccPublic) != 0) print.print("public "/*nonNLS*/); - if ((modifiers & AccPrivate) != 0) print.print("private "/*nonNLS*/); - if ((modifiers & AccFinal) != 0) print.print("final "/*nonNLS*/); - if ((modifiers & AccSuper) != 0) print.print("super "/*nonNLS*/); - if ((modifiers & AccInterface) != 0) print.print("interface "/*nonNLS*/); - if ((modifiers & AccAbstract) != 0) print.print("abstract "/*nonNLS*/); + if ((modifiers & AccPublic) != 0) print.print("public "); + if ((modifiers & AccPrivate) != 0) print.print("private "); + if ((modifiers & AccFinal) != 0) print.print("final "); + if ((modifiers & AccSuper) != 0) print.print("super "); + if ((modifiers & AccInterface) != 0) print.print("interface "); + if ((modifiers & AccAbstract) != 0) print.print("abstract "); print.flush(); return out.toString(); } @@ -270,7 +265,7 @@ // if name begins with the < character it must be clinit or init if (name[0] == '<') { - if (new String(name).equals("<clinit>"/*nonNLS*/) || new String(name).equals("<init>"/*nonNLS*/)) { + if (new String(name).equals("<clinit>") || new String(name).equals("<init>")) { int signatureLength = signature.length; if (!((signatureLength > 2) && (signature[0] == '(')
diff --git a/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFormatException.java b/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFormatException.java index d43bf73..26da065 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFormatException.java +++ b/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFormatException.java
@@ -1,10 +1,5 @@ package org.eclipse.jdt.internal.compiler.classfmt; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; - + public class ClassFormatException extends Exception { private int errorCode; private int bufferPosition; @@ -40,7 +35,7 @@ public static final int ErrIncorrectInterfaceMethods = 26; public static final int ErrInvalidMethodName = 27; public static final int ErrInvalidMethodSignature = 28; - + /** * (c)1998 Object Technology International. * (c)1998 International Business Machines Corporation.
diff --git a/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java b/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java index 0c371b5..613906f 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java +++ b/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java
@@ -261,22 +261,22 @@ StringBuffer buffer = new StringBuffer(this.getClass().getName()); int modifiers = getModifiers(); return buffer - .append("{"/*nonNLS*/) + .append("{") .append( - ((modifiers & AccDeprecated) != 0 ? "deprecated "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0001) == 1 ? "public "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0002) == 0x0002 ? "private "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0004) == 0x0004 ? "protected "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0008) == 0x000008 ? "static "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0010) == 0x0010 ? "final "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0040) == 0x0040 ? "volatile "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0080) == 0x0080 ? "transient "/*nonNLS*/ : ""/*nonNLS*/)) + ((modifiers & AccDeprecated) != 0 ? "deprecated " : "") + + ((modifiers & 0x0001) == 1 ? "public " : "") + + ((modifiers & 0x0002) == 0x0002 ? "private " : "") + + ((modifiers & 0x0004) == 0x0004 ? "protected " : "") + + ((modifiers & 0x0008) == 0x000008 ? "static " : "") + + ((modifiers & 0x0010) == 0x0010 ? "final " : "") + + ((modifiers & 0x0040) == 0x0040 ? "volatile " : "") + + ((modifiers & 0x0080) == 0x0080 ? "transient " : "")) .append(getTypeName()) - .append(" "/*nonNLS*/) + .append(" ") .append(getName()) - .append(" "/*nonNLS*/) + .append(" ") .append(getConstant()) - .append("}"/*nonNLS*/) + .append("}") .toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/classfmt/InnerClassInfo.java b/compiler/org/eclipse/jdt/internal/compiler/classfmt/InnerClassInfo.java index 3cc4f94..739916b 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/classfmt/InnerClassInfo.java +++ b/compiler/org/eclipse/jdt/internal/compiler/classfmt/InnerClassInfo.java
@@ -4,13 +4,13 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import org.eclipse.jdt.internal.compiler.env.*; - /** * Describes one entry in the classes table of the InnerClasses attribute. * See the inner class specification (The class file attribute "InnerClasses"). */ +import org.eclipse.jdt.internal.compiler.env.*; + public class InnerClassInfo extends ClassFileStruct implements IBinaryNestedType { int innerClassNameIndex = -1; int outerClassNameIndex = -1; @@ -109,11 +109,11 @@ if (getName() != null) { buffer.append(getName()); } - buffer.append("\n"/*nonNLS*/); + buffer.append("\n"); if (getEnclosingTypeName() != null) { buffer.append(getEnclosingTypeName()); } - buffer.append("\n"/*nonNLS*/); + buffer.append("\n"); if (getSourceName() != null) { buffer.append(getSourceName()); }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java b/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java index 06146a5..d373a81 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java +++ b/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java
@@ -192,19 +192,19 @@ int modifiers = getModifiers(); StringBuffer buffer = new StringBuffer(this.getClass().getName()); return buffer - .append("{"/*nonNLS*/) + .append("{") .append( - ((modifiers & AccDeprecated) != 0 ? "deprecated "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0001) == 1 ? "public "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0002) == 0x0002 ? "private "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0004) == 0x0004 ? "protected "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0008) == 0x000008 ? "static "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0010) == 0x0010 ? "final "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0040) == 0x0040 ? "volatile "/*nonNLS*/ : ""/*nonNLS*/) - + ((modifiers & 0x0080) == 0x0080 ? "transient "/*nonNLS*/ : ""/*nonNLS*/)) + ((modifiers & AccDeprecated) != 0 ? "deprecated " : "") + + ((modifiers & 0x0001) == 1 ? "public " : "") + + ((modifiers & 0x0002) == 0x0002 ? "private " : "") + + ((modifiers & 0x0004) == 0x0004 ? "protected " : "") + + ((modifiers & 0x0008) == 0x000008 ? "static " : "") + + ((modifiers & 0x0010) == 0x0010 ? "final " : "") + + ((modifiers & 0x0040) == 0x0040 ? "volatile " : "") + + ((modifiers & 0x0080) == 0x0080 ? "transient " : "")) .append(getSelector()) .append(getMethodDescriptor()) - .append("}"/*nonNLS*/) + .append("}") .toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java index cff7340..aad366b 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java
@@ -1,10 +1,5 @@ package org.eclipse.jdt.internal.compiler.codegen; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; - + public interface AttributeNamesConstants { final char[] SyntheticName = new char[] {'S', 'y', 'n', 't', 'h', 'e', 't', 'i', 'c'}; final char[] ConstantValueName = new char[] {'C', 'o', 'n', 's', 't', 'a', 'n', 't', 'V', 'a', 'l', 'u', 'e'};
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/CharArrayCache.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/CharArrayCache.java index aa41c79..d38fddd 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/CharArrayCache.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/CharArrayCache.java
@@ -166,16 +166,16 @@ public String toString() { int max = size(); StringBuffer buf = new StringBuffer(); - buf.append("{"/*nonNLS*/); + buf.append("{"); for (int i = 0; i < max; ++i) { if (keyTable[i] != null) { - buf.append(keyTable[i]).append("->"/*nonNLS*/).append(valueTable[i]); + buf.append(keyTable[i]).append("->").append(valueTable[i]); } if (i < max) { - buf.append(", "/*nonNLS*/); + buf.append(", "); } } - buf.append("}"/*nonNLS*/); + buf.append("}"); return buf.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java index acb59b9..4e16f03 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
@@ -1369,7 +1369,7 @@ // Wrap the code in an exception handler to convert a ClassNotFoundException into a NoClassDefError anyExceptionHandler = new ExceptionLabel(this, TypeBinding.NullBinding /* represents ClassNotFoundException*/); - this.ldc(accessedType == TypeBinding.NullBinding ? "java.lang.Object"/*nonNLS*/ : String.valueOf(accessedType.constantPoolName()).replace('/', '.')); + this.ldc(accessedType == TypeBinding.NullBinding ? "java.lang.Object" : String.valueOf(accessedType.constantPoolName()).replace('/', '.')); this.invokeClassForName(); /* We need to protect the runtime code from binary inconsistencies @@ -1429,7 +1429,7 @@ anewarrayJavaLangClass(); dup(); iconst_0(); - ldc("java.lang.String"/*nonNLS*/); + ldc("java.lang.String"); invokeClassForName(); aastore(); invokeConstructorGetConstructor(); @@ -1773,28 +1773,28 @@ char[][] wrapperTypeCompoundName = null; switch (valueType.id) { case T_int : // new: java.lang.Integer - wrapperTypeCompoundName = new char[][] {"java"/*nonNLS*/.toCharArray(), "lang"/*nonNLS*/.toCharArray(), "Integer"/*nonNLS*/.toCharArray()}; + wrapperTypeCompoundName = new char[][] {"java".toCharArray(), "lang".toCharArray(), "Integer".toCharArray()}; break; case T_boolean : // new: java.lang.Boolean - wrapperTypeCompoundName = new char[][] {"java"/*nonNLS*/.toCharArray(), "lang"/*nonNLS*/.toCharArray(), "Boolean"/*nonNLS*/.toCharArray()}; + wrapperTypeCompoundName = new char[][] {"java".toCharArray(), "lang".toCharArray(), "Boolean".toCharArray()}; break; case T_byte : // new: java.lang.Byte - wrapperTypeCompoundName = new char[][] {"java"/*nonNLS*/.toCharArray(), "lang"/*nonNLS*/.toCharArray(), "Byte"/*nonNLS*/.toCharArray()}; + wrapperTypeCompoundName = new char[][] {"java".toCharArray(), "lang".toCharArray(), "Byte".toCharArray()}; break; case T_char : // new: java.lang.Character - wrapperTypeCompoundName = new char[][] {"java"/*nonNLS*/.toCharArray(), "lang"/*nonNLS*/.toCharArray(), "Character"/*nonNLS*/.toCharArray()}; + wrapperTypeCompoundName = new char[][] {"java".toCharArray(), "lang".toCharArray(), "Character".toCharArray()}; break; case T_float : // new: java.lang.Float - wrapperTypeCompoundName = new char[][] {"java"/*nonNLS*/.toCharArray(), "lang"/*nonNLS*/.toCharArray(), "Float"/*nonNLS*/.toCharArray()}; + wrapperTypeCompoundName = new char[][] {"java".toCharArray(), "lang".toCharArray(), "Float".toCharArray()}; break; case T_double : // new: java.lang.Double - wrapperTypeCompoundName = new char[][] {"java"/*nonNLS*/.toCharArray(), "lang"/*nonNLS*/.toCharArray(), "Double"/*nonNLS*/.toCharArray()}; + wrapperTypeCompoundName = new char[][] {"java".toCharArray(), "lang".toCharArray(), "Double".toCharArray()}; break; case T_short : // new: java.lang.Short - wrapperTypeCompoundName = new char[][] {"java"/*nonNLS*/.toCharArray(), "lang"/*nonNLS*/.toCharArray(), "Short"/*nonNLS*/.toCharArray()}; + wrapperTypeCompoundName = new char[][] {"java".toCharArray(), "lang".toCharArray(), "Short".toCharArray()}; break; case T_long : // new: java.lang.Long - wrapperTypeCompoundName = new char[][] {"java"/*nonNLS*/.toCharArray(), "lang"/*nonNLS*/.toCharArray(), "Long"/*nonNLS*/.toCharArray()}; + wrapperTypeCompoundName = new char[][] {"java".toCharArray(), "lang".toCharArray(), "Long".toCharArray()}; break; } TypeBinding wrapperType = methodDeclaration.scope.getType(wrapperTypeCompoundName); @@ -5304,15 +5304,15 @@ } } public String toString() { - StringBuffer buffer = new StringBuffer("( position:"/*nonNLS*/); + StringBuffer buffer = new StringBuffer("( position:"); buffer.append(position); - buffer.append(",\nstackDepth:"/*nonNLS*/); + buffer.append(",\nstackDepth:"); buffer.append(stackDepth); - buffer.append(",\nmaxStack:"/*nonNLS*/); + buffer.append(",\nmaxStack:"); buffer.append(stackMax); - buffer.append(",\nmaxLocals:"/*nonNLS*/); + buffer.append(",\nmaxLocals:"); buffer.append(maxLocals); - buffer.append(")"/*nonNLS*/); + buffer.append(")"); return buffer.toString(); } public void updateLastRecordedEndPC(int pos) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java index e87240f..f40110f 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
@@ -70,7 +70,7 @@ final static int JAVA_LANG_ERROR_TYPE = 17; final static int JAVA_LANG_EXCEPTION_TYPE = 18; final static int JAVA_LANG_REFLECT_CONSTRUCTOR_TYPE = 19; - // predefined constant index for well known fields + // predefined constant index for well known fields final static int TYPE_BYTE_FIELD = 0; final static int TYPE_SHORT_FIELD = 1; final static int TYPE_CHARACTER_FIELD = 2; @@ -81,7 +81,7 @@ final static int TYPE_BOOLEAN_FIELD = 7; final static int TYPE_VOID_FIELD = 8; final static int OUT_SYSTEM_FIELD = 9; - // predefined constant index for well known methods + // predefined constant index for well known methods final static int FORNAME_CLASS_METHOD = 0; final static int NOCLASSDEFFOUNDERROR_CONSTR_METHOD = 1; final static int APPEND_INT_METHOD = 2; @@ -136,25 +136,22 @@ final static int VALUEOF_CHAR_METHOD_NAME_AND_TYPE = 21; final static int VALUEOF_BOOLEAN_METHOD_NAME_AND_TYPE = 22; final static int VALUEOF_DOUBLE_METHOD_NAME_AND_TYPE = 23; - public ClassFile classFile; - /** * ConstantPool constructor comment. */ public ConstantPool(ClassFile classFile) { - this.UTF8Cache = new CharArrayCache(UTF8_INITIAL_SIZE); - this.stringCache = new CharArrayCache(STRING_INITIAL_SIZE); - this.fieldCache = new ObjectCache(FIELD_INITIAL_SIZE); - this.methodCache = new ObjectCache(METHOD_INITIAL_SIZE); - this.interfaceMethodCache = new ObjectCache(INTERFACE_INITIAL_SIZE); - this.classCache = new ObjectCache(CLASS_INITIAL_SIZE); - this.nameAndTypeCacheForMethods = new MethodNameAndTypeCache(NAMEANDTYPE_INITIAL_SIZE); - this.nameAndTypeCacheForFields = new FieldNameAndTypeCache(NAMEANDTYPE_INITIAL_SIZE); - this.poolContent = classFile.header; - this.currentOffset = classFile.headerOffset; + UTF8Cache = new CharArrayCache(UTF8_INITIAL_SIZE); + stringCache = new CharArrayCache(STRING_INITIAL_SIZE); + fieldCache = new ObjectCache(FIELD_INITIAL_SIZE); + methodCache = new ObjectCache(METHOD_INITIAL_SIZE); + interfaceMethodCache = new ObjectCache(INTERFACE_INITIAL_SIZE); + classCache = new ObjectCache(CLASS_INITIAL_SIZE); + nameAndTypeCacheForMethods = new MethodNameAndTypeCache(NAMEANDTYPE_INITIAL_SIZE); + nameAndTypeCacheForFields = new FieldNameAndTypeCache(NAMEANDTYPE_INITIAL_SIZE); + poolContent = classFile.header; + currentOffset = classFile.headerOffset; // currentOffset is initialized to 0 by default - this.currentIndex = 1; - this.classFile = classFile; + currentIndex = 1; } /** * Return the content of the receiver @@ -337,7 +334,7 @@ if ((methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Intern))) { // This method binding is toString() return INTERN_METHOD_NAME_AND_TYPE; - } + } } return -1; } @@ -410,7 +407,7 @@ } else if ((firstChar == '<') && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Init))) { if ((methodBinding.parameters.length == 1) && (methodBinding.parameters[0].id == T_JavaLangString)) { - // This method binding is <init>(String) + // This method binding is <init>(String) return STRINGBUFFER_STRING_CONSTR_METHOD; } else { if (methodBinding.parameters.length == 0) { @@ -504,9 +501,6 @@ if ((index = UTF8Cache.get(stringCharArray)) < 0) { // The entry doesn't exit yet index = UTF8Cache.put(stringCharArray, currentIndex); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } currentIndex++; // Write the tag first writeU1(Utf8Tag); @@ -583,10 +577,7 @@ return -1; } index = UTF8Cache.put(utf8Constant, currentIndex); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } - currentIndex++; + currentIndex++; // Now we know the length that we have to write in the constant pool // we use savedCurrentOffset to do that poolContent[savedCurrentOffset] = (byte) (length >> 8); @@ -601,9 +592,6 @@ // The entry doesn't exit yet stringIndex = literalIndex(utf8encoding, stringCharArray); index = stringCache.put(stringCharArray, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the tag first writeU1(StringTag); // Then the string index @@ -631,9 +619,6 @@ } if ((index = doubleCache.get(key)) < 0) { index = doubleCache.put(key, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } currentIndex++; // a double needs an extra place into the constant pool // Write the double into the constant pool // First add the tag @@ -670,9 +655,6 @@ } if ((index = floatCache.get(key)) < 0) { index = floatCache.put(key, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the float constant entry into the constant pool // First add the tag writeU1(FloatTag); @@ -708,9 +690,6 @@ } if ((index = intCache.get(key)) < 0) { index = intCache.put(key, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the integer constant entry into the constant pool // First add the tag writeU1(IntegerTag); @@ -747,9 +726,6 @@ } if ((index = longCache.get(key)) < 0) { index = longCache.put(key, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } currentIndex++; // long value need an extra place into thwe constant pool // Write the long into the constant pool // First add the tag @@ -780,9 +756,6 @@ // The entry doesn't exit yet int stringIndex = literalIndex(stringCharArray); index = stringCache.put(stringCharArray, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the tag first writeU1(StringTag); // Then the string index @@ -808,9 +781,6 @@ classIndex = literalIndex(aFieldBinding.declaringClass); nameAndTypeIndex = literalIndexForFields(literalIndex(aFieldBinding.name), literalIndex(aFieldBinding.type.signature()), aFieldBinding); index = fieldCache.put(aFieldBinding, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -821,9 +791,6 @@ classIndex = literalIndex(aFieldBinding.declaringClass); nameAndTypeIndex = literalIndexForFields(literalIndex(aFieldBinding.name), literalIndex(aFieldBinding.type.signature()), aFieldBinding); index = wellKnownFields[indexWellKnownField] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -852,9 +819,6 @@ classIndex = literalIndex(aMethodBinding.declaringClass); nameAndTypeIndex = literalIndexForMethods(literalIndex(aMethodBinding.constantPoolName()), literalIndex(aMethodBinding.signature()), aMethodBinding); index = interfaceMethodCache.put(aMethodBinding, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the interface method ref constant into the constant pool // First add the tag writeU1(InterfaceMethodRefTag); @@ -869,9 +833,6 @@ classIndex = literalIndex(aMethodBinding.declaringClass); nameAndTypeIndex = literalIndexForMethods(literalIndex(aMethodBinding.constantPoolName()), literalIndex(aMethodBinding.signature()), aMethodBinding); index = methodCache.put(aMethodBinding, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -890,9 +851,6 @@ classIndex = literalIndex(aMethodBinding.declaringClass); nameAndTypeIndex = literalIndexForMethods(literalIndex(aMethodBinding.constantPoolName()), literalIndex(aMethodBinding.signature()), aMethodBinding); index = wellKnownMethods[indexWellKnownMethod] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the interface method ref constant into the constant pool // First add the tag writeU1(InterfaceMethodRefTag); @@ -905,9 +863,6 @@ classIndex = literalIndex(aMethodBinding.declaringClass); nameAndTypeIndex = literalIndexForMethods(literalIndex(aMethodBinding.constantPoolName()), literalIndex(aMethodBinding.signature()), aMethodBinding); index = wellKnownMethods[indexWellKnownMethod] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -935,9 +890,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(aTypeBinding.constantPoolName()); index = classCache.put(aTypeBinding, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -947,9 +899,6 @@ // Need to insert that binding nameIndex = literalIndex(aTypeBinding.constantPoolName()); index = wellKnownTypes[indexWellKnownType] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -974,9 +923,6 @@ if ((index = nameAndTypeCacheForFields.get(key)) == -1) { // The entry doesn't exit yet index = nameAndTypeCacheForFields.put(key, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(NameAndTypeTag); writeU2(nameIndex); writeU2(typeIndex); @@ -984,9 +930,6 @@ } else { if ((index = wellKnownFieldNameAndTypes[indexOfWellKnownFieldNameAndType]) == 0) { index = wellKnownFieldNameAndTypes[indexOfWellKnownFieldNameAndType] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(NameAndTypeTag); writeU2(nameIndex); writeU2(typeIndex); @@ -1007,9 +950,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangBooleanConstantPoolName); index = wellKnownTypes[JAVA_LANG_BOOLEAN_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1038,9 +978,6 @@ writeU2(typeIndex); } index = wellKnownFields[TYPE_BOOLEAN_FIELD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -1060,9 +997,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangByteConstantPoolName); index = wellKnownTypes[JAVA_LANG_BYTE_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1091,9 +1025,6 @@ writeU2(typeIndex); } index = wellKnownFields[TYPE_BYTE_FIELD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -1113,9 +1044,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangCharacterConstantPoolName); index = wellKnownTypes[JAVA_LANG_CHARACTER_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1144,9 +1072,6 @@ writeU2(typeIndex); } index = wellKnownFields[TYPE_CHARACTER_FIELD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -1166,9 +1091,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangClassConstantPoolName); index = wellKnownTypes[JAVA_LANG_CLASS_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1198,9 +1120,6 @@ writeU2(typeIndex); } index = wellKnownMethods[FORNAME_CLASS_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1234,9 +1153,6 @@ writeU2(typeIndex); } index = wellKnownMethods[GETCONSTRUCTOR_CLASS_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1260,9 +1176,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangClassNotFoundExceptionConstantPoolName); index = wellKnownTypes[JAVA_LANG_CLASSNOTFOUNDEXCEPTION_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1282,9 +1195,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangDoubleConstantPoolName); index = wellKnownTypes[JAVA_LANG_DOUBLE_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1313,9 +1223,6 @@ writeU2(typeIndex); } index = wellKnownFields[TYPE_DOUBLE_FIELD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -1335,9 +1242,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangErrorConstantPoolName); index = wellKnownTypes[JAVA_LANG_ERROR_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1367,9 +1271,6 @@ writeU2(typeIndex); } index = wellKnownMethods[JAVALANGERROR_CONSTR_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1386,9 +1287,6 @@ // The entry doesn't exit yet int nameIndex = literalIndex(QualifiedNamesConstants.JavaLangExceptionConstantPoolName); index = wellKnownTypes[JAVA_LANG_EXCEPTION_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1408,9 +1306,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangFloatConstantPoolName); index = wellKnownTypes[JAVA_LANG_FLOAT_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1439,9 +1334,6 @@ writeU2(typeIndex); } index = wellKnownFields[TYPE_FLOAT_FIELD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -1461,9 +1353,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangIntegerConstantPoolName); index = wellKnownTypes[JAVA_LANG_INTEGER_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1492,9 +1381,6 @@ writeU2(typeIndex); } index = wellKnownFields[TYPE_INTEGER_FIELD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -1514,9 +1400,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangLongConstantPoolName); index = wellKnownTypes[JAVA_LANG_LONG_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1545,9 +1428,6 @@ writeU2(typeIndex); } index = wellKnownFields[TYPE_LONG_FIELD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -1567,9 +1447,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangNoClassDefFoundErrorConstantPoolName); index = wellKnownTypes[JAVA_LANG_NOCLASSDEFFOUNDERROR_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1599,9 +1476,6 @@ writeU2(typeIndex); } index = wellKnownMethods[NOCLASSDEFFOUNDERROR_CONSTR_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1625,9 +1499,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangObjectConstantPoolName); index = wellKnownTypes[JAVA_LANG_OBJECT_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1647,9 +1518,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangReflectConstructor); index = wellKnownTypes[JAVA_LANG_REFLECT_CONSTRUCTOR_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1672,9 +1540,6 @@ writeU2(typeIndex); } index = wellKnownMethods[NEWINSTANCE_CONSTRUCTOR_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1698,9 +1563,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangShortConstantPoolName); index = wellKnownTypes[JAVA_LANG_SHORT_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1729,9 +1591,6 @@ writeU2(typeIndex); } index = wellKnownFields[TYPE_SHORT_FIELD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -1751,9 +1610,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangStringConstantPoolName); index = wellKnownTypes[JAVA_LANG_STRING_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1773,9 +1629,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangStringBufferConstantPoolName); index = wellKnownTypes[JAVA_LANG_STRINGBUFFER_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -1808,9 +1661,6 @@ writeU2(typeIndex); } index = wellKnownMethods[APPEND_INT_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1832,9 +1682,6 @@ writeU2(typeIndex); } index = wellKnownMethods[APPEND_LONG_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1856,9 +1703,6 @@ writeU2(typeIndex); } index = wellKnownMethods[APPEND_FLOAT_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1880,9 +1724,6 @@ writeU2(typeIndex); } index = wellKnownMethods[APPEND_DOUBLE_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1904,9 +1745,6 @@ writeU2(typeIndex); } index = wellKnownMethods[APPEND_CHAR_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1928,9 +1766,6 @@ writeU2(typeIndex); } index = wellKnownMethods[APPEND_BOOLEAN_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1952,9 +1787,6 @@ writeU2(typeIndex); } index = wellKnownMethods[APPEND_OBJECT_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -1977,9 +1809,6 @@ writeU2(typeIndex); } index = wellKnownMethods[APPEND_STRING_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2015,9 +1844,6 @@ writeU2(typeIndex); } index = wellKnownMethods[STRINGBUFFER_STRING_CONSTR_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2051,9 +1877,6 @@ writeU2(typeIndex); } index = wellKnownMethods[STRINGBUFFER_DEFAULT_CONSTR_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2087,9 +1910,6 @@ writeU2(typeIndex); } index = wellKnownMethods[STRINGBUFFER_TOSTRING_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2123,9 +1943,6 @@ writeU2(typeIndex); } index = wellKnownMethods[STRING_INTERN_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2161,9 +1978,6 @@ writeU2(typeIndex); } index = wellKnownMethods[VALUEOF_INT_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2184,9 +1998,6 @@ writeU2(typeIndex); } index = wellKnownMethods[VALUEOF_LONG_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2207,9 +2018,6 @@ writeU2(typeIndex); } index = wellKnownMethods[VALUEOF_FLOAT_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2230,9 +2038,6 @@ writeU2(typeIndex); } index = wellKnownMethods[VALUEOF_DOUBLE_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2253,9 +2058,6 @@ writeU2(typeIndex); } index = wellKnownMethods[VALUEOF_CHAR_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2276,9 +2078,6 @@ writeU2(typeIndex); } index = wellKnownMethods[VALUEOF_BOOLEAN_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2299,9 +2098,6 @@ writeU2(typeIndex); } index = wellKnownMethods[VALUEOF_OBJECT_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2327,9 +2123,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangSystemConstantPoolName); index = wellKnownTypes[JAVA_LANG_SYSTEM_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -2359,9 +2152,6 @@ writeU2(typeIndex); } index = wellKnownMethods[SYSTEM_EXIT_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2394,9 +2184,6 @@ writeU2(typeIndex); } index = wellKnownFields[OUT_SYSTEM_FIELD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -2416,9 +2203,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangThrowableConstantPoolName); index = wellKnownTypes[JAVA_LANG_THROWABLE_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -2448,9 +2232,6 @@ writeU2(typeIndex); } index = wellKnownMethods[THROWABLE_GETMESSAGE_METHOD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the method ref constant into the constant pool // First add the tag writeU1(MethodRefTag); @@ -2474,9 +2255,6 @@ // The entry doesn't exit yet nameIndex = literalIndex(QualifiedNamesConstants.JavaLangVoidConstantPoolName); index = wellKnownTypes[JAVA_LANG_VOID_TYPE] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(ClassTag); // Then add the 8 bytes representing the long writeU2(nameIndex); @@ -2505,9 +2283,6 @@ writeU2(typeIndex); } index = wellKnownFields[TYPE_VOID_FIELD] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(FieldRefTag); writeU2(classIndex); writeU2(nameAndTypeIndex); @@ -2574,9 +2349,6 @@ poolContent[savedCurrentOffset + 1] = (byte) length; } index = stringCache.put(stringCharArray, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } // Write the tag first writeU1(StringTag); // Then the string index @@ -2601,9 +2373,6 @@ if ((index = nameAndTypeCacheForMethods.get(key)) == -1) { // The entry doesn't exit yet index = nameAndTypeCacheForMethods.put(key, currentIndex++); - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(NameAndTypeTag); writeU2(nameIndex); writeU2(typeIndex); @@ -2611,9 +2380,6 @@ } else { if ((index = wellKnownMethodNameAndTypes[indexOfWellKnownMethodNameAndType]) == 0) { index = wellKnownMethodNameAndTypes[indexOfWellKnownMethodNameAndType] = currentIndex++; - if (index > 0xFFFF){ - this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType()); - } writeU1(NameAndTypeTag); writeU2(nameIndex); writeU2(typeIndex);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/DoubleCache.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/DoubleCache.java index 7711e17..f375835 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/DoubleCache.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/DoubleCache.java
@@ -1,10 +1,5 @@ package org.eclipse.jdt.internal.compiler.codegen; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; - + public class DoubleCache { private double keyTable[]; private int valueTable[]; @@ -21,7 +16,7 @@ * Constructs a new, empty hashtable with the specified initial * capacity. * @param initialCapacity int - * the initial number of buckets + * the initial number of buckets */ public DoubleCache(int initialCapacity) { elementSize = 0; @@ -69,7 +64,7 @@ * hashtable. * @param key <CODE>double</CODE> the specified key * @return int the element for the key or -1 if the key is not - * defined in the hash table. + * defined in the hash table. * @see ConstantPoolCache#put */ public int get(double key) { @@ -120,16 +115,16 @@ public String toString() { int max = elementSize; StringBuffer buf = new StringBuffer(); - buf.append("{"/*nonNLS*/); + buf.append("{"); for (int i = 0; i < max; ++i) { if ((keyTable[i] != 0) || ((keyTable[i] == 0) &&(valueTable[i] != 0))) { - buf.append(keyTable[i]).append("->"/*nonNLS*/).append(valueTable[i]); + buf.append(keyTable[i]).append("->").append(valueTable[i]); } if (i < max) { - buf.append(", "/*nonNLS*/); + buf.append(", "); } } - buf.append("}"/*nonNLS*/); + buf.append("}"); return buf.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/ExceptionLabel.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/ExceptionLabel.java index 9bfa121..a081e4e 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/ExceptionLabel.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/ExceptionLabel.java
@@ -6,7 +6,7 @@ */ import org.eclipse.jdt.internal.compiler.lookup.*; - public class ExceptionLabel extends Label { + public class ExceptionLabel extends Label { public int start = POS_NOT_SET; public int end = POS_NOT_SET; public TypeBinding exceptionType;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/FieldNameAndTypeCache.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/FieldNameAndTypeCache.java index 4ea1f89..cdd56fc 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/FieldNameAndTypeCache.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/FieldNameAndTypeCache.java
@@ -143,16 +143,16 @@ public String toString() { int max = size(); StringBuffer buf = new StringBuffer(); - buf.append("{"/*nonNLS*/); + buf.append("{"); for (int i = 0; i < max; ++i) { if (keyTable[i] != null) { - buf.append(keyTable[i]).append("->"/*nonNLS*/).append(valueTable[i]); + buf.append(keyTable[i]).append("->").append(valueTable[i]); } if (i < max) { - buf.append(", "/*nonNLS*/); + buf.append(", "); } } - buf.append("}"/*nonNLS*/); + buf.append("}"); return buf.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/FloatCache.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/FloatCache.java index 3480a6c..d0bdf01 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/FloatCache.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/FloatCache.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.codegen; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class FloatCache { private float keyTable[]; @@ -21,7 +16,7 @@ * Constructs a new, empty hashtable with the specified initial * capacity. * @param initialCapacity int - * the initial number of buckets + * the initial number of buckets */ public FloatCache(int initialCapacity) { elementSize = 0; @@ -69,7 +64,7 @@ * hashtable. * @param key <CODE>float</CODE> the specified key * @return int the element for the key or -1 if the key is not - * defined in the hash table. + * defined in the hash table. * @see ConstantPoolCache#put */ public int get(float key) { @@ -120,16 +115,16 @@ public String toString() { int max = elementSize; StringBuffer buf = new StringBuffer(); - buf.append("{"/*nonNLS*/); + buf.append("{"); for (int i = 0; i < max; ++i) { if ((keyTable[i] != 0) || ((keyTable[i] == 0) && (valueTable[i] != 0))) { - buf.append(keyTable[i]).append("->"/*nonNLS*/).append(valueTable[i]); + buf.append(keyTable[i]).append("->").append(valueTable[i]); } if (i < max) { - buf.append(", "/*nonNLS*/); + buf.append(", "); } } - buf.append("}"/*nonNLS*/); + buf.append("}"); return buf.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/IntegerCache.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/IntegerCache.java index d49b8b3..3879a3f 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/IntegerCache.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/IntegerCache.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.codegen; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class IntegerCache { public int keyTable[]; @@ -22,7 +17,7 @@ * Constructs a new, empty hashtable with the specified initial * capacity. * @param initialCapacity int - * the initial number of buckets + * the initial number of buckets */ public IntegerCache(int initialCapacity) { elementSize = 0; @@ -59,7 +54,7 @@ * hashtable. * @param key <CODE>double</CODE> the specified key * @return int the element for the key or -1 if the key is not - * defined in the hash table. + * defined in the hash table. * @see ConstantPoolCache#put */ public int get(int key) { @@ -138,16 +133,16 @@ public String toString() { int max = size(); StringBuffer buf = new StringBuffer(); - buf.append("{"/*nonNLS*/); + buf.append("{"); for (int i = 0; i < max; ++i) { if ((keyTable[i] != 0) || ((keyTable[i] == 0) && (valueTable[i] != 0))) { - buf.append(keyTable[i]).append("->"/*nonNLS*/).append(valueTable[i]); + buf.append(keyTable[i]).append("->").append(valueTable[i]); } if (i < max) { - buf.append(", "/*nonNLS*/); + buf.append(", "); } } - buf.append("}"/*nonNLS*/); + buf.append("}"); return buf.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/Label.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/Label.java index a621896..0891b99 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/Label.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/Label.java
@@ -190,14 +190,14 @@ * Print out the receiver */ public String toString() { - StringBuffer buffer = new StringBuffer("(position="/*nonNLS*/); + StringBuffer buffer = new StringBuffer("(position="); buffer.append(position); - buffer.append(", forwards = ["/*nonNLS*/); + buffer.append(", forwards = ["); for (int i = 0; i < forwardReferenceCount - 1; i++) - buffer.append(forwardReferences[i] + ", "/*nonNLS*/); + buffer.append(forwardReferences[i] + ", "); if (forwardReferenceCount >= 1) buffer.append(forwardReferences[forwardReferenceCount-1]); - buffer.append("] )"/*nonNLS*/); + buffer.append("] )"); return buffer.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/LongCache.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/LongCache.java index a59397f..bb8579f 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/LongCache.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/LongCache.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.codegen; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class LongCache { public long keyTable[]; @@ -22,7 +17,7 @@ * Constructs a new, empty hashtable with the specified initial * capacity. * @param initialCapacity int - * the initial number of buckets + * the initial number of buckets */ public LongCache(int initialCapacity) { elementSize = 0; @@ -59,7 +54,7 @@ * hashtable. * @param key <CODE>long</CODE> the specified key * @return int the element for the key or -1 if the key is not - * defined in the hash table. + * defined in the hash table. * @see ConstantPoolCache#put */ public int get(long key) { @@ -138,16 +133,16 @@ public String toString() { int max = size(); StringBuffer buf = new StringBuffer(); - buf.append("{"/*nonNLS*/); + buf.append("{"); for (int i = 0; i < max; ++i) { if ((keyTable[i] != 0) || ((keyTable[i] == 0) && (valueTable[i] != 0))) { - buf.append(keyTable[i]).append("->"/*nonNLS*/).append(valueTable[i]); + buf.append(keyTable[i]).append("->").append(valueTable[i]); } if (i < max) { - buf.append(", "/*nonNLS*/); + buf.append(", "); } } - buf.append("}"/*nonNLS*/); + buf.append("}"); return buf.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/MethodNameAndTypeCache.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/MethodNameAndTypeCache.java index 2d50853..b4fba36 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/MethodNameAndTypeCache.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/MethodNameAndTypeCache.java
@@ -144,16 +144,16 @@ public String toString() { int max = size(); StringBuffer buf = new StringBuffer(); - buf.append("{"/*nonNLS*/); + buf.append("{"); for (int i = 0; i < max; ++i) { if (keyTable[i] != null) { - buf.append(keyTable[i]).append("->"/*nonNLS*/).append(valueTable[i]); + buf.append(keyTable[i]).append("->").append(valueTable[i]); } if (i < max) { - buf.append(", "/*nonNLS*/); + buf.append(", "); } } - buf.append("}"/*nonNLS*/); + buf.append("}"); return buf.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/ObjectCache.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/ObjectCache.java index 63cb51f..ab71008 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/ObjectCache.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/ObjectCache.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.codegen; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class ObjectCache { public Object keyTable[]; @@ -21,7 +16,7 @@ * Constructs a new, empty hashtable with the specified initial * capacity. * @param initialCapacity int - * the initial number of buckets + * the initial number of buckets */ public ObjectCache(int initialCapacity) { this.elementSize = 0; @@ -58,7 +53,7 @@ * hashtable. * @param key <CODE>char[]</CODE> the specified key * @return int the element for the key or -1 if the key is not - * defined in the hash table. + * defined in the hash table. * @see ConstantPoolCache#put */ public int get(Object key) { @@ -135,16 +130,16 @@ public String toString() { int max = size(); StringBuffer buf = new StringBuffer(); - buf.append("{"/*nonNLS*/); + buf.append("{"); for (int i = 0; i < max; ++i) { if (keyTable[i] != null) { - buf.append(keyTable[i]).append("->"/*nonNLS*/).append(valueTable[i]); + buf.append(keyTable[i]).append("->").append(valueTable[i]); } if (i < max) { - buf.append(", "/*nonNLS*/); + buf.append(", "); } } - buf.append("}"/*nonNLS*/); + buf.append("}"); return buf.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/Opcodes.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/Opcodes.java index 7e6861c..224cdd1 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/Opcodes.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/Opcodes.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.codegen; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface Opcodes {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/QualifiedNamesConstants.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/QualifiedNamesConstants.java index edefbdd..0330b3e 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/codegen/QualifiedNamesConstants.java +++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/QualifiedNamesConstants.java
@@ -6,26 +6,26 @@ import org.eclipse.jdt.internal.compiler.problem.*; public interface QualifiedNamesConstants { - char[] JavaLangObjectConstantPoolName = "java/lang/Object"/*nonNLS*/.toCharArray(); - char[] JavaLangStringConstantPoolName = "java/lang/String"/*nonNLS*/.toCharArray(); - char[] JavaLangStringBufferConstantPoolName = "java/lang/StringBuffer"/*nonNLS*/.toCharArray(); - char[] JavaLangClassConstantPoolName = "java/lang/Class"/*nonNLS*/.toCharArray(); - char[] JavaLangThrowableConstantPoolName = "java/lang/Throwable"/*nonNLS*/.toCharArray(); - char[] JavaLangClassNotFoundExceptionConstantPoolName = "java/lang/ClassNotFoundException"/*nonNLS*/.toCharArray(); - char[] JavaLangNoClassDefFoundErrorConstantPoolName = "java/lang/NoClassDefFoundError"/*nonNLS*/.toCharArray(); - char[] JavaLangIntegerConstantPoolName = "java/lang/Integer"/*nonNLS*/.toCharArray(); - char[] JavaLangFloatConstantPoolName = "java/lang/Float"/*nonNLS*/.toCharArray(); - char[] JavaLangDoubleConstantPoolName = "java/lang/Double"/*nonNLS*/.toCharArray(); - char[] JavaLangLongConstantPoolName = "java/lang/Long"/*nonNLS*/.toCharArray(); - char[] JavaLangShortConstantPoolName = "java/lang/Short"/*nonNLS*/.toCharArray(); - char[] JavaLangByteConstantPoolName = "java/lang/Byte"/*nonNLS*/.toCharArray(); - char[] JavaLangCharacterConstantPoolName = "java/lang/Character"/*nonNLS*/.toCharArray(); - char[] JavaLangVoidConstantPoolName = "java/lang/Void"/*nonNLS*/.toCharArray(); - char[] JavaLangBooleanConstantPoolName = "java/lang/Boolean"/*nonNLS*/.toCharArray(); - char[] JavaLangSystemConstantPoolName = "java/lang/System"/*nonNLS*/.toCharArray(); - char[] JavaLangErrorConstantPoolName = "java/lang/Error"/*nonNLS*/.toCharArray(); - char[] JavaLangExceptionConstantPoolName = "java/lang/Exception"/*nonNLS*/.toCharArray(); - char[] JavaLangReflectConstructor = "java/lang/reflect/Constructor"/*nonNLS*/.toCharArray(); + char[] JavaLangObjectConstantPoolName = "java/lang/Object".toCharArray(); + char[] JavaLangStringConstantPoolName = "java/lang/String".toCharArray(); + char[] JavaLangStringBufferConstantPoolName = "java/lang/StringBuffer".toCharArray(); + char[] JavaLangClassConstantPoolName = "java/lang/Class".toCharArray(); + char[] JavaLangThrowableConstantPoolName = "java/lang/Throwable".toCharArray(); + char[] JavaLangClassNotFoundExceptionConstantPoolName = "java/lang/ClassNotFoundException".toCharArray(); + char[] JavaLangNoClassDefFoundErrorConstantPoolName = "java/lang/NoClassDefFoundError".toCharArray(); + char[] JavaLangIntegerConstantPoolName = "java/lang/Integer".toCharArray(); + char[] JavaLangFloatConstantPoolName = "java/lang/Float".toCharArray(); + char[] JavaLangDoubleConstantPoolName = "java/lang/Double".toCharArray(); + char[] JavaLangLongConstantPoolName = "java/lang/Long".toCharArray(); + char[] JavaLangShortConstantPoolName = "java/lang/Short".toCharArray(); + char[] JavaLangByteConstantPoolName = "java/lang/Byte".toCharArray(); + char[] JavaLangCharacterConstantPoolName = "java/lang/Character".toCharArray(); + char[] JavaLangVoidConstantPoolName = "java/lang/Void".toCharArray(); + char[] JavaLangBooleanConstantPoolName = "java/lang/Boolean".toCharArray(); + char[] JavaLangSystemConstantPoolName = "java/lang/System".toCharArray(); + char[] JavaLangErrorConstantPoolName = "java/lang/Error".toCharArray(); + char[] JavaLangExceptionConstantPoolName = "java/lang/Exception".toCharArray(); + char[] JavaLangReflectConstructor = "java/lang/reflect/Constructor".toCharArray(); char[] Append = new char[] {'a', 'p', 'p', 'e', 'n', 'd'}; char[] ToString = new char[] {'t', 'o', 'S', 't', 'r', 'i', 'n', 'g'}; char[] Init = new char[] {'<', 'i', 'n', 'i', 't', '>'}; @@ -33,41 +33,41 @@ char[] ValueOf = new char[] {'v', 'a', 'l', 'u', 'e', 'O', 'f'}; char[] ForName = new char[] {'f', 'o', 'r', 'N', 'a', 'm', 'e'}; char[] GetMessage = new char[] {'g', 'e', 't', 'M', 'e', 's', 's', 'a', 'g', 'e'}; - char[] NewInstance = "newInstance"/*nonNLS*/.toCharArray(); - char[] GetConstructor = "getConstructor"/*nonNLS*/.toCharArray(); + char[] NewInstance = "newInstance".toCharArray(); + char[] GetConstructor = "getConstructor".toCharArray(); char[] Exit = new char[] {'e', 'x', 'i', 't'}; - char[] Intern = "intern"/*nonNLS*/.toCharArray(); + char[] Intern = "intern".toCharArray(); char[] Out = new char[] {'o', 'u', 't'}; char[] TYPE = new char[] {'T', 'Y', 'P', 'E'}; char[] This = new char[] {'t', 'h', 'i', 's'}; char[] JavaLangClassSignature = new char[] {'L', 'j', 'a', 'v', 'a', '/', 'l', 'a', 'n', 'g', '/', 'C', 'l', 'a', 's', 's', ';'}; - char[] ForNameSignature = "(Ljava/lang/String;)Ljava/lang/Class;"/*nonNLS*/.toCharArray(); - char[] GetMessageSignature = "()Ljava/lang/String;"/*nonNLS*/.toCharArray(); - char[] GetConstructorSignature = "([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;"/*nonNLS*/.toCharArray(); - char[] StringConstructorSignature = "(Ljava/lang/String;)V"/*nonNLS*/.toCharArray(); - char[] NewInstanceSignature = "([Ljava/lang/Object;)Ljava/lang/Object;"/*nonNLS*/.toCharArray(); + char[] ForNameSignature = "(Ljava/lang/String;)Ljava/lang/Class;".toCharArray(); + char[] GetMessageSignature = "()Ljava/lang/String;".toCharArray(); + char[] GetConstructorSignature = "([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;".toCharArray(); + char[] StringConstructorSignature = "(Ljava/lang/String;)V".toCharArray(); + char[] NewInstanceSignature = "([Ljava/lang/Object;)Ljava/lang/Object;".toCharArray(); char[] DefaultConstructorSignature = {'(', ')', 'V'}; char[] ClinitSignature = DefaultConstructorSignature; char[] ToStringSignature = GetMessageSignature; char[] InternSignature = GetMessageSignature; - char[] AppendIntSignature = "(I)Ljava/lang/StringBuffer;"/*nonNLS*/.toCharArray(); - char[] AppendLongSignature = "(J)Ljava/lang/StringBuffer;"/*nonNLS*/.toCharArray(); - char[] AppendFloatSignature = "(F)Ljava/lang/StringBuffer;"/*nonNLS*/.toCharArray(); - char[] AppendDoubleSignature = "(D)Ljava/lang/StringBuffer;"/*nonNLS*/.toCharArray(); - char[] AppendCharSignature = "(C)Ljava/lang/StringBuffer;"/*nonNLS*/.toCharArray(); - char[] AppendBooleanSignature = "(Z)Ljava/lang/StringBuffer;"/*nonNLS*/.toCharArray(); - char[] AppendObjectSignature = "(Ljava/lang/Object;)Ljava/lang/StringBuffer;"/*nonNLS*/.toCharArray(); - char[] AppendStringSignature = "(Ljava/lang/String;)Ljava/lang/StringBuffer;"/*nonNLS*/.toCharArray(); - char[] ValueOfObjectSignature = "(Ljava/lang/Object;)Ljava/lang/String;"/*nonNLS*/.toCharArray(); - char[] ValueOfIntSignature = "(I)Ljava/lang/String;"/*nonNLS*/.toCharArray(); - char[] ValueOfLongSignature = "(J)Ljava/lang/String;"/*nonNLS*/.toCharArray(); - char[] ValueOfCharSignature = "(C)Ljava/lang/String;"/*nonNLS*/.toCharArray(); - char[] ValueOfBooleanSignature = "(Z)Ljava/lang/String;"/*nonNLS*/.toCharArray(); - char[] ValueOfDoubleSignature = "(D)Ljava/lang/String;"/*nonNLS*/.toCharArray(); - char[] ValueOfFloatSignature = "(F)Ljava/lang/String;"/*nonNLS*/.toCharArray(); - char[] JavaIoPrintStreamSignature = "Ljava/io/PrintStream;"/*nonNLS*/.toCharArray(); + char[] AppendIntSignature = "(I)Ljava/lang/StringBuffer;".toCharArray(); + char[] AppendLongSignature = "(J)Ljava/lang/StringBuffer;".toCharArray(); + char[] AppendFloatSignature = "(F)Ljava/lang/StringBuffer;".toCharArray(); + char[] AppendDoubleSignature = "(D)Ljava/lang/StringBuffer;".toCharArray(); + char[] AppendCharSignature = "(C)Ljava/lang/StringBuffer;".toCharArray(); + char[] AppendBooleanSignature = "(Z)Ljava/lang/StringBuffer;".toCharArray(); + char[] AppendObjectSignature = "(Ljava/lang/Object;)Ljava/lang/StringBuffer;".toCharArray(); + char[] AppendStringSignature = "(Ljava/lang/String;)Ljava/lang/StringBuffer;".toCharArray(); + char[] ValueOfObjectSignature = "(Ljava/lang/Object;)Ljava/lang/String;".toCharArray(); + char[] ValueOfIntSignature = "(I)Ljava/lang/String;".toCharArray(); + char[] ValueOfLongSignature = "(J)Ljava/lang/String;".toCharArray(); + char[] ValueOfCharSignature = "(C)Ljava/lang/String;".toCharArray(); + char[] ValueOfBooleanSignature = "(Z)Ljava/lang/String;".toCharArray(); + char[] ValueOfDoubleSignature = "(D)Ljava/lang/String;".toCharArray(); + char[] ValueOfFloatSignature = "(F)Ljava/lang/String;".toCharArray(); + char[] JavaIoPrintStreamSignature = "Ljava/io/PrintStream;".toCharArray(); char[] ExitIntSignature = new char[] {'(', 'I', ')', 'V'}; - char[] ArrayJavaLangObjectConstantPoolName = "[Ljava/lang/Object;"/*nonNLS*/.toCharArray(); - char[] ArrayJavaLangClassConstantPoolName = "[Ljava/lang/Class;"/*nonNLS*/.toCharArray(); + char[] ArrayJavaLangObjectConstantPoolName = "[Ljava/lang/Object;".toCharArray(); + char[] ArrayJavaLangClassConstantPoolName = "[Ljava/lang/Class;".toCharArray(); }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java b/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java index e1b24ec..8aa155e 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java
@@ -1,15 +1,4 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; - -// clinit methods (synthetics too?) can be returned from IBinaryType>>getMethods() -// BUT do not have to be... the compiler will ignore them when building the binding. -// The synthetic argument of a member type's constructor (ie. the first arg of a non-static -// member type) is also ignored by the compiler, BUT in this case it must be included -// in the constructor's signature. public interface IBinaryMethod extends IGenericMethod { /**
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryNestedType.java b/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryNestedType.java index 0bc363b..15a4587 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryNestedType.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryNestedType.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface IBinaryNestedType { /**
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java b/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java index 6b0bee4..9fa5bd3 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface IBinaryType extends IGenericType { @@ -67,12 +62,4 @@ */ char[] getSuperclassName(); - -/** - * Answer the source file attribute, or null if none. - * - * For example, "String.java" - */ - -char[] sourceFileName(); }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/ICompilationUnit.java b/compiler/org/eclipse/jdt/internal/compiler/env/ICompilationUnit.java index 1ce4eec..2d4efa1 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/ICompilationUnit.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/ICompilationUnit.java
@@ -1,13 +1,5 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; -/** - * This interface denotes a compilation unit, providing its name and content. - */ public interface ICompilationUnit extends IDependent { /** * Answer the contents of the compilation unit.
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/IConstants.java b/compiler/org/eclipse/jdt/internal/compiler/env/IConstants.java index 48efe75..ff189d0 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/IConstants.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/IConstants.java
@@ -1,13 +1,5 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; -/** - * This interface defines constants for use by the builder / compiler interface. - */ public interface IConstants { /*
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/IDependent.java b/compiler/org/eclipse/jdt/internal/compiler/env/IDependent.java index 5663ff6..e61401d 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/IDependent.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/IDependent.java
@@ -1,18 +1,5 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; -/** - * This represents the target (ie. the file) of a type dependency. - * - * All implementors of this interface are containers for types or types - * themselves which must be able to identify their source file name - * when file dependencies are collected. - * @see IDependencyInfo - */ public interface IDependent { /** * Answer the file name which defines the type.
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/IGenericField.java b/compiler/org/eclipse/jdt/internal/compiler/env/IGenericField.java index 7b22b39..dcf9264 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/IGenericField.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/IGenericField.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface IGenericField { /**
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/IGenericMethod.java b/compiler/org/eclipse/jdt/internal/compiler/env/IGenericMethod.java index 52b385d..3fc4d5c 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/IGenericMethod.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/IGenericMethod.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface IGenericMethod { /**
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/IGenericType.java b/compiler/org/eclipse/jdt/internal/compiler/env/IGenericType.java index 3050ede..5fd27dc 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/IGenericType.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/IGenericType.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface IGenericType extends IDependent { /**
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/INameEnvironment.java b/compiler/org/eclipse/jdt/internal/compiler/env/INameEnvironment.java index a58d100..bf64e8e 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/INameEnvironment.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/INameEnvironment.java
@@ -1,16 +1,5 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; -/** - * The name environment provides a callback API that the compiler - * can use to look up types, compilation units, and packages in the - * current environment. The name environment is passed to the compiler - * on creation. - */ public interface INameEnvironment { /** * Find a type with the given compound name. @@ -48,8 +37,8 @@ * The default package is always assumed to exist. * * For example: - * isPackage({{java}, {awt}}, {event}); - * isPackage(null, {java}); + * isPackage({{java}, {awt}}, {event}); + * isPackage(null, {java}); */ boolean isPackage(char[][] parentPackageName, char[] packageName);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/ISourceField.java b/compiler/org/eclipse/jdt/internal/compiler/env/ISourceField.java index 5dfd047..d6cf1c9 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/ISourceField.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/ISourceField.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface ISourceField extends IGenericField { /**
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java b/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java index a83406e..d6bf432 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface ISourceMethod extends IGenericMethod { /**
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java b/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java index 3e2790d..25370d7 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface ISourceType extends IGenericType { /**
diff --git a/compiler/org/eclipse/jdt/internal/compiler/env/NameEnvironmentAnswer.java b/compiler/org/eclipse/jdt/internal/compiler/env/NameEnvironmentAnswer.java index ecfee24..a0a88ad 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/env/NameEnvironmentAnswer.java +++ b/compiler/org/eclipse/jdt/internal/compiler/env/NameEnvironmentAnswer.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.env; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class NameEnvironmentAnswer { // only one of the three can be set
diff --git a/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java b/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java index 307d43a..d9e0b94 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java +++ b/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java
@@ -114,7 +114,7 @@ return unconditionalInits().mergedWith(otherInits); } public String toString() { - return "FlowInfo<true: "/*nonNLS*/ + initsWhenTrue.toString() + ", false: "/*nonNLS*/ + initsWhenFalse.toString() + ">"/*nonNLS*/; + return "FlowInfo<true: " + initsWhenTrue.toString() + ", false: " + initsWhenFalse.toString() + ">"; } public UnconditionalFlowInfo unconditionalInits() { return initsWhenTrue.unconditionalInits().copy()
diff --git a/compiler/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java b/compiler/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java index 426698c..f780094 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java +++ b/compiler/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java
@@ -91,7 +91,7 @@ tryStatement.preserveExceptionHandler = isNeeded; } public String individualToString() { - StringBuffer buffer = new StringBuffer("Exception flow context"/*nonNLS*/); + StringBuffer buffer = new StringBuffer("Exception flow context"); int length = handledExceptions.length; for (int i = 0; i < length; i++) { int cacheIndex = i / BitCacheSize; @@ -99,12 +99,12 @@ buffer.append('[').append(handledExceptions[i].readableName()); if ((isReached[cacheIndex] & bitMask) != 0) { if ((isNeeded[cacheIndex] & bitMask) == 0) { - buffer.append("-masked"/*nonNLS*/); + buffer.append("-masked"); } else { - buffer.append("-reached"/*nonNLS*/); + buffer.append("-reached"); } } else { - buffer.append("-not reached"/*nonNLS*/); + buffer.append("-not reached"); } buffer.append('-').append(initsOnExceptions[i].toString()).append(']'); }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java b/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java index 329ccbf..c278d20 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java +++ b/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java
@@ -326,7 +326,7 @@ return null; } public String individualToString(){ - return "Flow context"/*nonNLS*/; + return "Flow context"; } public FlowInfo initsOnBreak() { return FlowInfo.DeadEnd;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java b/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java index 74ef42c..9adc7d5 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java +++ b/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java
@@ -37,7 +37,7 @@ /** * Check status of definite assignment for a field. */ - abstract public boolean isDefinitelyAssigned(FieldBinding field); + abstract public boolean isDefinitelyAssigned(FieldBinding field); /** * Check status of definite assignment for a local. */ @@ -46,11 +46,11 @@ /** * Check status of potential assignment for a field. */ - abstract public boolean isPotentiallyAssigned(FieldBinding field); + abstract public boolean isPotentiallyAssigned(FieldBinding field); /** * Check status of potential assignment for a local variable. */ - abstract public boolean isPotentiallyAssigned(LocalVariableBinding field); + abstract public boolean isPotentiallyAssigned(LocalVariableBinding field); /** * Record a field got definitely assigned. */ @@ -71,7 +71,7 @@ abstract public UnconditionalFlowInfo mergedWith(UnconditionalFlowInfo otherInits); public String toString(){ if (this == DeadEnd){ - return "FlowInfo.DeadEnd"/*nonNLS*/; + return "FlowInfo.DeadEnd"; } return super.toString(); }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/flow/LabelFlowContext.java b/compiler/org/eclipse/jdt/internal/compiler/flow/LabelFlowContext.java index 0a65428..efc0133 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/flow/LabelFlowContext.java +++ b/compiler/org/eclipse/jdt/internal/compiler/flow/LabelFlowContext.java
@@ -38,7 +38,7 @@ } } public String individualToString(){ - return "Label flow context [label:"/*nonNLS*/+String.valueOf(labelName)+"]"/*nonNLS*/; + return "Label flow context [label:"+String.valueOf(labelName)+"]"; } public char[] labelName() { return labelName;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java b/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java index 93acbaf..bfb76a5 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java +++ b/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java
@@ -56,7 +56,7 @@ return continueLabel; } public String individualToString(){ - return "Looping flow context"/*nonNLS*/; + return "Looping flow context"; } public boolean isContinuable() { return true;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java b/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java index 33a77b5..b260036 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java +++ b/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java
@@ -28,7 +28,7 @@ return breakLabel; } public String individualToString(){ - return "Switch flow context"/*nonNLS*/; + return "Switch flow context"; } public boolean isBreakable() { return true;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java b/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java index 77b1654..a728c81 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java +++ b/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java
@@ -187,9 +187,8 @@ * Check status of definite assignment for a field. */ final public boolean isDefinitelyAssigned(FieldBinding field) { - // Dependant of CodeStream.isDefinitelyAssigned(..) // We do not want to complain in unreachable code - if ((this == DeadEnd) || (this.isFakeReachable)) + if (this == DeadEnd) return true; return isDefinitelyAssigned(field.id); } @@ -420,9 +419,9 @@ } public String toString(){ if (this == DeadEnd){ - return "FlowInfo.DeadEnd"/*nonNLS*/; + return "FlowInfo.DeadEnd"; } - return "FlowInfo<def: "/*nonNLS*/+ definiteInits +", pot: "/*nonNLS*/ + potentialInits + ">"/*nonNLS*/; + return "FlowInfo<def: "+ definiteInits +", pot: " + potentialInits + ">"; } public UnconditionalFlowInfo unconditionalInits() { // also see conditional inits, where it requests them to merge
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java index 7f9a421..79629b9 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java
@@ -23,13 +23,13 @@ String s = new Boolean(value).toString() ; if (s == null) - return "null"/*nonNLS*/; + return "null"; else return s; } public String toString(){ - return "(boolean)"/*nonNLS*/ + value ; } + return "(boolean)" + value ; } public int typeID() { return T_boolean; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java index 5d88da8..ab623e1 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class ByteConstant extends Constant { byte value; @@ -36,13 +31,13 @@ String s = new Integer(value).toString() ; if (s == null) - return "null"/*nonNLS*/; + return "null"; else return s; } public String toString(){ - return "(byte)"/*nonNLS*/ + value ; } + return "(byte)" + value ; } public int typeID() { return T_byte; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java index 5b40213..f797adf 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java
@@ -39,13 +39,13 @@ String s = new Character(value).toString() ; if (s == null) - return "null"/*nonNLS*/; + return "null"; else return s; } public String toString(){ - return "(char)"/*nonNLS*/ + value ; } + return "(char)" + value ; } public int typeID() { return T_char; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java index 3360076..0ef8127 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
@@ -46,7 +46,7 @@ public boolean parseLiteralExpressionsAsConstants = true; // exception raised for unresolved compile errors - public String runtimeExceptionNameForCompileError = "java.lang.Error"/*nonNLS*/; + public String runtimeExceptionNameForCompileError = "java.lang.Error"; // toggle private access emulation for 1.2 (constr. accessor has extra arg on constructor) or 1.3 (make private constructor default access when access needed) public boolean isPrivateConstructorAccessChangingVisibility = false; // by default, follows 1.2 @@ -79,79 +79,74 @@ return new ConfigurableOption[] { new ConfigurableOption( componentName, - "debug.vars"/*nonNLS*/, + "debug.vars", locale, (produceDebugAttributes & Vars) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "debug.lines"/*nonNLS*/, + "debug.lines", locale, (produceDebugAttributes & Lines) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "debug.source"/*nonNLS*/, + "debug.source", locale, (produceDebugAttributes & Source) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "debug.preserveAllLocals"/*nonNLS*/, + "debug.preserveAllLocals", locale, preserveAllLocalVariables ? 0 : 1), new ConfigurableOption( componentName, - "optionalError.unReachableCode"/*nonNLS*/, + "optionalError.unReachableCode", locale, (errorThreshold & UnreachableCode) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "optionalError.importProblem"/*nonNLS*/, + "optionalError.importProblem", locale, (errorThreshold & ImportProblem) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "optionalWarning.methodWithConstructorName"/*nonNLS*/, + "optionalWarning.methodWithConstructorName", locale, (warningThreshold & MethodWithConstructorName) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "optionalWarning.overridingPackageDefaultMethod"/*nonNLS*/, + "optionalWarning.overridingPackageDefaultMethod", locale, (warningThreshold & OverriddenPackageDefaultMethod) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "optionalWarning.deprecated"/*nonNLS*/, + "optionalWarning.deprecated", locale, (warningThreshold & UsingDeprecatedAPI) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "optionalWarning.maskedCatchBlock"/*nonNLS*/, + "optionalWarning.maskedCatchBlock", locale, (warningThreshold & MaskedCatchBlock) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "optionalWarning.unusedLocalVariable"/*nonNLS*/, + "optionalWarning.unusedLocalVariable", locale, (warningThreshold & UnusedLocalVariable) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "optionalWarning.unusedArgument"/*nonNLS*/, + "optionalWarning.unusedArgument", locale, (warningThreshold & UnusedArgument) != 0 ? 0 : 1), new ConfigurableOption( componentName, - "binaryCompatibility.targetJDK"/*nonNLS*/, + "binaryCompatibility.targetJDK", locale, targetJDK), new ConfigurableOption( componentName, - "optionalWarning.accessEmulation"/*nonNLS*/, + "optionalWarning.accessEmulation", locale, - (warningThreshold & AccessEmulation) != 0 ? 0 : 1), - new ConfigurableOption( - componentName, - "optionalWarning.nonExternalizedString"/*nonNLS*/, - locale, - (warningThreshold & NonExternalizedString) != 0 ? 0 : 1) + (warningThreshold & AccessEmulation) != 0 ? 0 : 1) }; } public int getDebugAttributesMask() { @@ -358,9 +353,6 @@ case 15: // synthetic access emulation handleAccessEmulationAsWarning(setting.getCurrentValueIndex() == 0); break; - case 16: // non externalized string literal - handleNonExternalizedStringLiteralAsWarning(setting.getCurrentValueIndex() == 0); - break; } } public void setTargetJDK(int vmID) { @@ -374,140 +366,110 @@ } public String toString() { - StringBuffer buf = new StringBuffer("CompilerOptions:"/*nonNLS*/); + StringBuffer buf = new StringBuffer("CompilerOptions:"); if ((produceDebugAttributes & Vars) != 0){ - buf.append("\n-local variables debug attributes: ON"/*nonNLS*/); + buf.append("\n-local variables debug attributes: ON"); } else { - buf.append("\n-local variables debug attributes: OFF"/*nonNLS*/); + buf.append("\n-local variables debug attributes: OFF"); } if ((produceDebugAttributes & Lines) != 0){ - buf.append("\n-line number debug attributes: ON"/*nonNLS*/); + buf.append("\n-line number debug attributes: ON"); } else { - buf.append("\n-line number debug attributes: OFF"/*nonNLS*/); + buf.append("\n-line number debug attributes: OFF"); } if ((produceDebugAttributes & Source) != 0){ - buf.append("\n-source debug attributes: ON"/*nonNLS*/); + buf.append("\n-source debug attributes: ON"); } else { - buf.append("\n-source debug attributes: OFF"/*nonNLS*/); + buf.append("\n-source debug attributes: OFF"); } if (preserveAllLocalVariables){ - buf.append("\n-preserve all local variables: ON"/*nonNLS*/); + buf.append("\n-preserve all local variables: ON"); } else { - buf.append("\n-preserve all local variables: OFF"/*nonNLS*/); + buf.append("\n-preserve all local variables: OFF"); } if ((errorThreshold & UnreachableCode) != 0){ - buf.append("\n-unreachable code: ERROR"/*nonNLS*/); + buf.append("\n-unreachable code: ERROR"); } else { if ((warningThreshold & UnreachableCode) != 0){ - buf.append("\n-unreachable code: WARNING"/*nonNLS*/); + buf.append("\n-unreachable code: WARNING"); } else { - buf.append("\n-unreachable code: IGNORE"/*nonNLS*/); + buf.append("\n-unreachable code: IGNORE"); } } if ((errorThreshold & ImportProblem) != 0){ - buf.append("\n-import problem: ERROR"/*nonNLS*/); + buf.append("\n-import problem: ERROR"); } else { if ((warningThreshold & ImportProblem) != 0){ - buf.append("\n-import problem: WARNING"/*nonNLS*/); + buf.append("\n-import problem: WARNING"); } else { - buf.append("\n-import problem: IGNORE"/*nonNLS*/); + buf.append("\n-import problem: IGNORE"); } } if ((errorThreshold & MethodWithConstructorName) != 0){ - buf.append("\n-method with constructor name: ERROR"/*nonNLS*/); + buf.append("\n-method with constructor name: ERROR"); } else { if ((warningThreshold & MethodWithConstructorName) != 0){ - buf.append("\n-method with constructor name: WARNING"/*nonNLS*/); + buf.append("\n-method with constructor name: WARNING"); } else { - buf.append("\n-method with constructor name: IGNORE"/*nonNLS*/); + buf.append("\n-method with constructor name: IGNORE"); } } if ((errorThreshold & OverriddenPackageDefaultMethod) != 0){ - buf.append("\n-overridden package default method: ERROR"/*nonNLS*/); + buf.append("\n-overridden package default method: ERROR"); } else { if ((warningThreshold & OverriddenPackageDefaultMethod) != 0){ - buf.append("\n-overridden package default method: WARNING"/*nonNLS*/); + buf.append("\n-overridden package default method: WARNING"); } else { - buf.append("\n-overridden package default method: IGNORE"/*nonNLS*/); + buf.append("\n-overridden package default method: IGNORE"); } } if ((errorThreshold & UsingDeprecatedAPI) != 0){ - buf.append("\n-deprecation: ERROR"/*nonNLS*/); + buf.append("\n-deprecation: ERROR"); } else { if ((warningThreshold & UsingDeprecatedAPI) != 0){ - buf.append("\n-deprecation: WARNING"/*nonNLS*/); + buf.append("\n-deprecation: WARNING"); } else { - buf.append("\n-deprecation: IGNORE"/*nonNLS*/); + buf.append("\n-deprecation: IGNORE"); } } if ((errorThreshold & MaskedCatchBlock) != 0){ - buf.append("\n-masked catch block: ERROR"/*nonNLS*/); + buf.append("\n-masked catch block: ERROR"); } else { if ((warningThreshold & MaskedCatchBlock) != 0){ - buf.append("\n-masked catch block: WARNING"/*nonNLS*/); + buf.append("\n-masked catch block: WARNING"); } else { - buf.append("\n-masked catch block: IGNORE"/*nonNLS*/); + buf.append("\n-masked catch block: IGNORE"); } } if ((errorThreshold & UnusedLocalVariable) != 0){ - buf.append("\n-unused local variable: ERROR"/*nonNLS*/); + buf.append("\n-unused local variable: ERROR"); } else { if ((warningThreshold & UnusedLocalVariable) != 0){ - buf.append("\n-unused local variable: WARNING"/*nonNLS*/); + buf.append("\n-unused local variable: WARNING"); } else { - buf.append("\n-unused local variable: IGNORE"/*nonNLS*/); + buf.append("\n-unused local variable: IGNORE"); } } if ((errorThreshold & UnusedArgument) != 0){ - buf.append("\n-unused parameter: ERROR"/*nonNLS*/); + buf.append("\n-unused parameter: ERROR"); } else { if ((warningThreshold & UnusedArgument) != 0){ - buf.append("\n-unused parameter: WARNING"/*nonNLS*/); + buf.append("\n-unused parameter: WARNING"); } else { - buf.append("\n-unused parameter: IGNORE"/*nonNLS*/); - } - } - if ((errorThreshold & AccessEmulation) != 0){ - buf.append("\n-synthetic access emulation: ERROR"/*nonNLS*/); - } else { - if ((warningThreshold & AccessEmulation) != 0){ - buf.append("\n-synthetic access emulation: WARNING"/*nonNLS*/); - } else { - buf.append("\n-synthetic access emulation: IGNORE"/*nonNLS*/); - } - } - if ((errorThreshold & NonExternalizedString) != 0){ - buf.append("\n-non externalized string: ERROR"/*nonNLS*/); - } else { - if ((warningThreshold & NonExternalizedString) != 0){ - buf.append("\n-non externalized string: WARNING"/*nonNLS*/); - } else { - buf.append("\n-non externalized string: IGNORE"/*nonNLS*/); + buf.append("\n-unused parameter: IGNORE"); } } switch(targetJDK){ case JDK1_1 : - buf.append("\n-target JDK: 1.1"/*nonNLS*/); + buf.append("\n-target JDK: 1.1"); break; case JDK1_2 : - buf.append("\n-target JDK: 1.2"/*nonNLS*/); + buf.append("\n-target JDK: 1.2"); } - buf.append("\n-verbose : "/*nonNLS*/ + (verbose ? "ON"/*nonNLS*/ : "OFF"/*nonNLS*/)); - buf.append("\n-produce reference info : "/*nonNLS*/ + (produceReferenceInfo ? "ON"/*nonNLS*/ : "OFF"/*nonNLS*/)); - buf.append("\n-parse literal expressions as constants : "/*nonNLS*/ + (parseLiteralExpressionsAsConstants ? "ON"/*nonNLS*/ : "OFF"/*nonNLS*/)); - buf.append("\n-runtime exception name for compile error : "/*nonNLS*/ + runtimeExceptionNameForCompileError); + buf.append("\n-verbose : " + (verbose ? "ON" : "OFF")); + buf.append("\n-produce reference info : " + (produceReferenceInfo ? "ON" : "OFF")); + buf.append("\n-parse literal expressions as constants : " + (parseLiteralExpressionsAsConstants ? "ON" : "OFF")); + buf.append("\n-runtime exception name for compile error : " + runtimeExceptionNameForCompileError); return buf.toString(); } - -public void handleNonExternalizedStringLiteralAsWarning(boolean flag) { - if (flag) { - warningThreshold |= NonExternalizedString; - } else { - warningThreshold &= ~NonExternalizedString; - } -} - -public boolean isNonExternalizedStringLiteralHandledAsWarning() { - return (warningThreshold & NonExternalizedString) != 0; -} }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/ConfigurableProblems.java b/compiler/org/eclipse/jdt/internal/compiler/impl/ConfigurableProblems.java index 4482fd9..85e85f9 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/ConfigurableProblems.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/ConfigurableProblems.java
@@ -1,11 +1,4 @@ package org.eclipse.jdt.internal.compiler.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; - -// constants used to encode configurable problems (error|warning|ignore) public interface ConfigurableProblems { final int UnreachableCode = 0x100; @@ -19,5 +12,4 @@ final int UnusedArgument = 0x20000; final int TemporaryWarning = 0x40000; final int AccessEmulation = 0x80000; - final int NonExternalizedString = 0x100000; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java index 92b55dd..bda078d 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java
@@ -16,10 +16,10 @@ public static final IntConstant Two = new IntConstant(2); public static final IntConstant One = new IntConstant(1); public boolean booleanValue() { - throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto"/*nonNLS*/,typeName(),"boolean"/*nonNLS*/)); + throw new ShouldNotImplement(typeName() + " constant cannot be casted into boolean"); } public byte byteValue() { - throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto"/*nonNLS*/,typeName(),"byte"/*nonNLS*/)); + throw new ShouldNotImplement(typeName()+ " constant cannot be casted into byte"); } public final Constant castTo(int conversionToTargetType){ //the cast is an int of the form @@ -218,7 +218,7 @@ return NotAConstant ; } public char charValue() { - throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto"/*nonNLS*/,typeName(),"char"/*nonNLS*/)); + throw new ShouldNotImplement(typeName()+ " constant cannot be casted into char"); } public static final Constant computeConstantOperation(Constant cst, int id, int operator) { //this method assumes that the TC has been done . @@ -1416,10 +1416,10 @@ return NotAConstant ;} // should not get here public double doubleValue() { - throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto"/*nonNLS*/,typeName(),"double"/*nonNLS*/)); + throw new ShouldNotImplement(typeName()+ " constant cannot be casted into double"); } public float floatValue() { - throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto"/*nonNLS*/,typeName(),"float"/*nonNLS*/)); + throw new ShouldNotImplement(typeName()+ " constant cannot be casted into float"); } public static Constant fromValue(byte value) { return new ByteConstant(value); @@ -1450,36 +1450,36 @@ return new BooleanConstant(value); } public int intValue() { - throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto"/*nonNLS*/,typeName(),"int"/*nonNLS*/)); + throw new ShouldNotImplement(typeName()+ " constant cannot be casted into int"); } public long longValue() { - throw new ShouldNotImplement(Util.bind("constant.cannotCastedInto"/*nonNLS*/,typeName(),"long"/*nonNLS*/)); + throw new ShouldNotImplement(typeName()+ " constant cannot be casted into long"); } public short shortValue() { - throw new ShouldNotImplement(Util.bind("constant.cannotConvertedTo"/*nonNLS*/,typeName(),"short"/*nonNLS*/)); + throw new ShouldNotImplement(typeName()+ " constant cannot be converted to short"); } /** Deprecated */ public String stringValue() { - throw new ShouldNotImplement(Util.bind("constant.cannotConvertedTo"/*nonNLS*/,typeName(),"String"/*nonNLS*/)); + throw new ShouldNotImplement(typeName()+ " constant cannot be converted to String"); } public String toString(){ - if (this == NotAConstant) return "(Constant) NotAConstant"/*nonNLS*/ ; + if (this == NotAConstant) return "(Constant) NotAConstant" ; return super.toString(); } public abstract int typeID(); public String typeName() { switch (typeID()) { - case T_int : return "int"/*nonNLS*/; - case T_byte : return "byte"/*nonNLS*/; - case T_short : return "short"/*nonNLS*/; - case T_char : return "char"/*nonNLS*/; - case T_float : return "float"/*nonNLS*/; - case T_double : return "double"/*nonNLS*/; - case T_boolean : return "boolean"/*nonNLS*/; - case T_String : return "java.lang.String"/*nonNLS*/; - case T_null : return "null"/*nonNLS*/; - default: return "unknown"/*nonNLS*/; + case T_int : return "int"; + case T_byte : return "byte"; + case T_short : return "short"; + case T_char : return "char"; + case T_float : return "float"; + case T_double : return "double"; + case T_boolean : return "boolean"; + case T_String : return "java.lang.String"; + case T_null : return "null"; + default: return "unknown"; } } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java index 522474c..f3242ae 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class DoubleConstant extends Constant { double value; @@ -36,14 +31,14 @@ String s = new Double(value).toString() ; if (s == null) - return "null"/*nonNLS*/; + return "null"; else return s; } public String toString(){ - if (this == NotAConstant) return "(Constant) NotAConstant"/*nonNLS*/ ; - return "(double)"/*nonNLS*/ + value ; } + if (this == NotAConstant) return "(Constant) NotAConstant" ; + return "(double)" + value ; } public int typeID() { return T_double; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java index 483ef5d..c109fbe 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class FloatConstant extends Constant { float value; @@ -36,13 +31,13 @@ String s = new Float(value).toString() ; if (s == null) - return "null"/*nonNLS*/; + return "null"; else return s; } public String toString(){ - return "(float)"/*nonNLS*/ + value ; } + return "(float)" + value ; } public int typeID() { return T_float; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java index 490196c..ae29374 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class IntConstant extends Constant { int value; @@ -36,13 +31,13 @@ String s = new Integer(value).toString() ; if (s == null) - return "null"/*nonNLS*/; + return "null"; else return s; } public String toString(){ - return "(int)"/*nonNLS*/ + value ; } + return "(int)" + value ; } public int typeID() { return T_int; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java index 911b81f..1108154 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class LongConstant extends Constant { long value; @@ -36,13 +31,13 @@ String s = new Long(value).toString() ; if (s == null) - return "null"/*nonNLS*/; + return "null"; else return s; } public String toString(){ - return "(long)"/*nonNLS*/ + value ; } + return "(long)" + value ; } public int typeID() { return T_long; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/NullConstant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/NullConstant.java index 6e24bf5..c2920e0 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/NullConstant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/NullConstant.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class NullConstant extends Constant { public static final NullConstant Default = new NullConstant(); @@ -17,7 +12,7 @@ } public String toString(){ - return "(null)"/*nonNLS*/ + null ; } + return "(null)" + null ; } public int typeID() { return T_null; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java index fd87ca9..5c33a35 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class ShortConstant extends Constant { short value; @@ -36,13 +31,13 @@ String s = new Integer(value).toString() ; if (s == null) - return "null"/*nonNLS*/; + return "null"; else return s; } public String toString(){ - return "(short)"/*nonNLS*/ + value ; } + return "(short)" + value ; } public int typeID() { return T_short; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java b/compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java index fe197d4..c589b5c 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java +++ b/compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java
@@ -1,13 +1,8 @@ package org.eclipse.jdt.internal.compiler.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class StringConstant extends Constant { public String value; - + public StringConstant(String value) { this.value = value ; } @@ -33,7 +28,7 @@ } public String toString(){ - return "(String)\""/*nonNLS*/ + value +"\""/*nonNLS*/; } + return "(String)\"" + value +"\""; } public int typeID() { return T_String; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java index 15e789c..0a5bc9a 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java
@@ -39,7 +39,7 @@ String debugName() { StringBuffer brackets = new StringBuffer(dimensions * 2); for (int i = dimensions; --i >= 0;) - brackets.append("[]"/*nonNLS*/); + brackets.append("[]"); return leafComponentType.debugName() + brackets.toString(); } /* Answer an array whose dimension size is one less than the receiver. @@ -128,6 +128,6 @@ return CharOperation.concat(leafComponentType.sourceName(), brackets); } public String toString() { - return leafComponentType != null ? debugName() : "NULL TYPE ARRAY"/*nonNLS*/; + return leafComponentType != null ? debugName() : "NULL TYPE ARRAY"; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java index d664852..e99f80a 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java
@@ -146,6 +146,6 @@ return simpleName; } public String toString() { - return new String(constantPoolName) + " (id="/*nonNLS*/ + id + ")"/*nonNLS*/; + return new String(constantPoolName) + " (id=" + id + ")"; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypes.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypes.java index 45caffe..214f2a5 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypes.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypes.java
@@ -1,19 +1,14 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface BaseTypes { - final BaseTypeBinding IntBinding = new BaseTypeBinding(TypeIds.T_int, "int"/*nonNLS*/.toCharArray(), new char[] {'I'}); - final BaseTypeBinding ByteBinding = new BaseTypeBinding(TypeIds.T_byte, "byte"/*nonNLS*/.toCharArray(), new char[] {'B'}); - final BaseTypeBinding ShortBinding = new BaseTypeBinding(TypeIds.T_short, "short"/*nonNLS*/.toCharArray(), new char[] {'S'}); - final BaseTypeBinding CharBinding = new BaseTypeBinding(TypeIds.T_char, "char"/*nonNLS*/.toCharArray(), new char[] {'C'}); - final BaseTypeBinding LongBinding = new BaseTypeBinding(TypeIds.T_long, "long"/*nonNLS*/.toCharArray(), new char[] {'J'}); - final BaseTypeBinding FloatBinding = new BaseTypeBinding(TypeIds.T_float, "float"/*nonNLS*/.toCharArray(), new char[] {'F'}); - final BaseTypeBinding DoubleBinding = new BaseTypeBinding(TypeIds.T_double, "double"/*nonNLS*/.toCharArray(), new char[] {'D'}); - final BaseTypeBinding BooleanBinding = new BaseTypeBinding(TypeIds.T_boolean, "boolean"/*nonNLS*/.toCharArray(), new char[] {'Z'}); - final BaseTypeBinding NullBinding = new BaseTypeBinding(TypeIds.T_null, "null"/*nonNLS*/.toCharArray(), new char[] {'N'}); //N stands for null even if it is never internally used - final BaseTypeBinding VoidBinding = new BaseTypeBinding(TypeIds.T_void, "void"/*nonNLS*/.toCharArray(), new char[] {'V'}); + final BaseTypeBinding IntBinding = new BaseTypeBinding(TypeIds.T_int, "int".toCharArray(), new char[] {'I'}); + final BaseTypeBinding ByteBinding = new BaseTypeBinding(TypeIds.T_byte, "byte".toCharArray(), new char[] {'B'}); + final BaseTypeBinding ShortBinding = new BaseTypeBinding(TypeIds.T_short, "short".toCharArray(), new char[] {'S'}); + final BaseTypeBinding CharBinding = new BaseTypeBinding(TypeIds.T_char, "char".toCharArray(), new char[] {'C'}); + final BaseTypeBinding LongBinding = new BaseTypeBinding(TypeIds.T_long, "long".toCharArray(), new char[] {'J'}); + final BaseTypeBinding FloatBinding = new BaseTypeBinding(TypeIds.T_float, "float".toCharArray(), new char[] {'F'}); + final BaseTypeBinding DoubleBinding = new BaseTypeBinding(TypeIds.T_double, "double".toCharArray(), new char[] {'D'}); + final BaseTypeBinding BooleanBinding = new BaseTypeBinding(TypeIds.T_boolean, "boolean".toCharArray(), new char[] {'Z'}); + final BaseTypeBinding NullBinding = new BaseTypeBinding(TypeIds.T_null, "null".toCharArray(), new char[] {'N'}); //N stands for null even if it is never internally used + final BaseTypeBinding VoidBinding = new BaseTypeBinding(TypeIds.T_void, "void".toCharArray(), new char[] {'V'}); }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java index 683a617..084aed3 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -376,71 +376,71 @@ return superInterfaces; } public String toString() { - String s = ""/*nonNLS*/; + String s = ""; - if (isDeprecated()) s += "deprecated "/*nonNLS*/; - if (isPublic()) s += "public "/*nonNLS*/; - if (isProtected()) s += "protected "/*nonNLS*/; - if (isPrivate()) s += "private "/*nonNLS*/; - if (isAbstract() && isClass()) s += "abstract "/*nonNLS*/; - if (isStatic() && isNestedType()) s += "static "/*nonNLS*/; - if (isFinal()) s += "final "/*nonNLS*/; + if (isDeprecated()) s += "deprecated "; + if (isPublic()) s += "public "; + if (isProtected()) s += "protected "; + if (isPrivate()) s += "private "; + if (isAbstract() && isClass()) s += "abstract "; + if (isStatic() && isNestedType()) s += "static "; + if (isFinal()) s += "final "; - s += isInterface() ? "interface "/*nonNLS*/ : "class "/*nonNLS*/; - s += (compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED TYPE"/*nonNLS*/; + s += isInterface() ? "interface " : "class "; + s += (compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED TYPE"; - s += "\n\textends "/*nonNLS*/; - s += (superclass != null) ? superclass.debugName() : "NULL TYPE"/*nonNLS*/; + s += "\n\textends "; + s += (superclass != null) ? superclass.debugName() : "NULL TYPE"; if (superInterfaces != null) { if (superInterfaces != NoSuperInterfaces) { - s += "\n\timplements : "/*nonNLS*/; + s += "\n\timplements : "; for (int i = 0, length = superInterfaces.length; i < length; i++) { if (i > 0) - s += ", "/*nonNLS*/; - s += (superInterfaces[i] != null) ? superInterfaces[i].debugName() : "NULL TYPE"/*nonNLS*/; + s += ", "; + s += (superInterfaces[i] != null) ? superInterfaces[i].debugName() : "NULL TYPE"; } } } else { - s += "NULL SUPERINTERFACES"/*nonNLS*/; + s += "NULL SUPERINTERFACES"; } if (enclosingType != null) { - s += "\n\tenclosing type : "/*nonNLS*/; + s += "\n\tenclosing type : "; s += enclosingType.debugName(); } if (fields != null) { if (fields != NoFields) { - s += "\n/* fields */"/*nonNLS*/; + s += "\n/* fields */"; for (int i = 0, length = fields.length; i < length; i++) - s += (fields[i] != null) ? "\n"/*nonNLS*/ + fields[i].toString() : "\nNULL FIELD"/*nonNLS*/; + s += (fields[i] != null) ? "\n" + fields[i].toString() : "\nNULL FIELD"; } } else { - s += "NULL FIELDS"/*nonNLS*/; + s += "NULL FIELDS"; } if (methods != null) { if (methods != NoMethods) { - s += "\n/* methods */"/*nonNLS*/; + s += "\n/* methods */"; for (int i = 0, length = methods.length; i < length; i++) - s += (methods[i] != null) ? "\n"/*nonNLS*/ + methods[i].toString() : "\nNULL METHOD"/*nonNLS*/; + s += (methods[i] != null) ? "\n" + methods[i].toString() : "\nNULL METHOD"; } } else { - s += "NULL METHODS"/*nonNLS*/; + s += "NULL METHODS"; } if (memberTypes != null) { if (memberTypes != NoMemberTypes) { - s += "\n/* members */"/*nonNLS*/; + s += "\n/* members */"; for (int i = 0, length = memberTypes.length; i < length; i++) - s += (memberTypes[i] != null) ? "\n"/*nonNLS*/ + memberTypes[i].toString() : "\nNULL TYPE"/*nonNLS*/; + s += (memberTypes[i] != null) ? "\n" + memberTypes[i].toString() : "\nNULL TYPE"; } } else { - s += "NULL MEMBER TYPES"/*nonNLS*/; + s += "NULL MEMBER TYPES"; } - s += "\n\n\n"/*nonNLS*/; + s += "\n\n\n"; return s; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java index 1d38a11..a413f8d 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public abstract class Binding implements BindingIds, CompilerModifiers, ProblemReasons { /* API
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/BindingIds.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/BindingIds.java index 738fa54..ba67d08 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/BindingIds.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/BindingIds.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface BindingIds { final int FIELD = 1;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java index a4e14bc..bc057f8 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java
@@ -139,16 +139,16 @@ || ((AbstractMethodDeclaration) methodScope.referenceContext).isInitializationMethod(); // inside constructor or clinit } String basicToString(int tab) { - String newLine = "\n"/*nonNLS*/; + String newLine = "\n"; for (int i = tab; --i >= 0;) - newLine += "\t"/*nonNLS*/; + newLine += "\t"; - String s = newLine + "--- Block Scope ---"/*nonNLS*/; - newLine += "\t"/*nonNLS*/; - s += newLine + "locals:"/*nonNLS*/; + String s = newLine + "--- Block Scope ---"; + newLine += "\t"; + s += newLine + "locals:"; for (int i = 0; i < localIndex; i++) - s += newLine + "\t"/*nonNLS*/ + locals[i].toString(); - s += newLine + "startIndex = "/*nonNLS*/ + startIndex; + s += newLine + "\t" + locals[i].toString(); + s += newLine + "startIndex = " + startIndex; return s; } private void checkAndSetModifiersForVariable(LocalVariableBinding varBinding) { @@ -670,23 +670,23 @@ // use synthetic constructor arguments if possible if (insideConstructor) { SyntheticArgumentBinding syntheticArg; - if ((syntheticArg = ((NestedTypeBinding) sourceType).getSyntheticArgument(targetEnclosingType, this, false)) != null) { + if ((syntheticArg = ((NestedTypeBinding) sourceType).getSyntheticArgument(targetEnclosingType, this)) != null) { return new Object[] {syntheticArg}; } } // use a direct synthetic field then if (!currentMethodScope.isStatic) { FieldBinding syntheticField; - if ((syntheticField = sourceType.getSyntheticField(targetEnclosingType, this, false)) != null) { + if ((syntheticField = sourceType.getSyntheticField(targetEnclosingType, this)) != null) { return new Object[] {syntheticField}; } // could be reached through a sequence of enclosing instance link (nested members) Object[] path = new Object[2]; // probably at least 2 of them ReferenceBinding currentType = sourceType.enclosingType(); if (insideConstructor) { - path[0] = ((NestedTypeBinding) sourceType).getSyntheticArgument((SourceTypeBinding)currentType, this, false); + path[0] = ((NestedTypeBinding) sourceType).getSyntheticArgument((SourceTypeBinding)currentType, this); } else { - path[0] = sourceType.getSyntheticField((SourceTypeBinding)currentType, this, false); + path[0] = sourceType.getSyntheticField((SourceTypeBinding)currentType, this); } if (path[0] != null) { // keep accumulating int count = 1; @@ -694,7 +694,7 @@ while ((currentEnclosingType = currentType.enclosingType()) != null) { //done? if (currentType == targetEnclosingType || targetEnclosingType.isSuperclassOf(currentType)) break; - syntheticField = ((NestedTypeBinding)currentType).getSyntheticField((SourceTypeBinding)currentEnclosingType, this, false); + syntheticField = ((NestedTypeBinding)currentType).getSyntheticField((SourceTypeBinding)currentEnclosingType, this); if (syntheticField == null) break; // append inside the path if (count == path.length) { @@ -889,23 +889,23 @@ // use synthetic constructor arguments if possible if (insideConstructor) { SyntheticArgumentBinding syntheticArg; - if ((syntheticArg = ((NestedTypeBinding) sourceType).getSyntheticArgument(targetEnclosingType, this, true)) != null) { + if ((syntheticArg = ((NestedTypeBinding) sourceType).getSyntheticArgument(targetEnclosingType, this)) != null) { return new Object[] {syntheticArg}; } } // use a direct synthetic field then if (!currentMethodScope.isStatic) { FieldBinding syntheticField; - if ((syntheticField = sourceType.getSyntheticField(targetEnclosingType, this, true)) != null) { + if ((syntheticField = sourceType.getSyntheticField(targetEnclosingType, this)) != null) { return new Object[] {syntheticField}; } // could be reached through a sequence of enclosing instance link (nested members) Object[] path = new Object[2]; // probably at least 2 of them ReferenceBinding currentType = sourceType.enclosingType(); if (insideConstructor) { - path[0] = ((NestedTypeBinding) sourceType).getSyntheticArgument((SourceTypeBinding)currentType, this, true); + path[0] = ((NestedTypeBinding) sourceType).getSyntheticArgument((SourceTypeBinding)currentType, this); } else { - path[0] = sourceType.getSyntheticField((SourceTypeBinding)currentType, this, true); + path[0] = sourceType.getSyntheticField((SourceTypeBinding)currentType, this); } if (path[0] != null) { // keep accumulating int count = 1; @@ -913,7 +913,7 @@ while ((currentEnclosingType = currentType.enclosingType()) != null) { //done? if (currentType == targetEnclosingType) break; - syntheticField = ((NestedTypeBinding)currentType).getSyntheticField((SourceTypeBinding)currentEnclosingType, this, true); + syntheticField = ((NestedTypeBinding)currentType).getSyntheticField((SourceTypeBinding)currentEnclosingType, this); if (syntheticField == null) break; // append inside the path if (count == path.length) { @@ -1175,7 +1175,7 @@ String s = basicToString(tab); for (int i = 0; i < scopeIndex; i++) if (subscopes[i] instanceof BlockScope) - s += ((BlockScope) subscopes[i]).toString(tab + 1) + "\n"/*nonNLS*/; + s += ((BlockScope) subscopes[i]).toString(tab + 1) + "\n"; return s; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java index 02a39d2..e45bfeb 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
@@ -802,8 +802,8 @@ } public String toString() { if (referenceContext != null) - return "--- Class Scope ---\n\n"/*nonNLS*/ + referenceContext.binding.toString(); + return "--- Class Scope ---\n\n" + referenceContext.binding.toString(); else - return "--- Class Scope ---\n\n Binding not initialized"/*nonNLS*/; + return "--- Class Scope ---\n\n Binding not initialized"; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java index 043fd7e..a054848 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
@@ -427,7 +427,7 @@ referenceContext.compilationResult.fileDependencies = fileNames; } public String toString() { - return "--- CompilationUnit Scope : "/*nonNLS*/ + new String(referenceContext.getFileName()); + return "--- CompilationUnit Scope : " + new String(referenceContext.getFileName()); } public void verifyMethods(MethodVerifier verifier) { for (int i = 0, length = topLevelTypes.length; i < length; i++)
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/ImportBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/ImportBinding.java index 1445d91..13dfa68 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/ImportBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/ImportBinding.java
@@ -25,11 +25,11 @@ } public char[] readableName() { if (onDemand) - return CharOperation.concat(CharOperation.concatWith(compoundName, '.'), ".*"/*nonNLS*/.toCharArray()); + return CharOperation.concat(CharOperation.concatWith(compoundName, '.'), ".*".toCharArray()); else return CharOperation.concatWith(compoundName, '.'); } public String toString() { - return "import : "/*nonNLS*/ + new String(readableName()); + return "import : " + new String(readableName()); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/InnerEmulationDependency.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/InnerEmulationDependency.java index d28168d..c570be4 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/InnerEmulationDependency.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/InnerEmulationDependency.java
@@ -1,15 +1,9 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class InnerEmulationDependency{ public BlockScope scope; public boolean wasEnclosingInstanceSupplied; public boolean useDirectAccess; - public InnerEmulationDependency(BlockScope scope, boolean wasEnclosingInstanceSupplied, boolean useDirectAccess) { this.scope = scope; this.wasEnclosingInstanceSupplied = wasEnclosingInstanceSupplied;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java index b3fecc7..41e14bd 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface InvocationSite { boolean isSuperAccess();
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java index d2de2d1..b8a66dd 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java
@@ -56,9 +56,9 @@ public char[] readableName() { if (isAnonymousType()) { if (superInterfaces == NoSuperInterfaces) - return ("<"/*nonNLS*/+Util.bind("binding.subclass"/*nonNLS*/,new String(superclass.readableName())) + ">"/*nonNLS*/).toCharArray(); + return ("<anonymous subclass of " + new String(superclass.readableName()) + ">").toCharArray(); else - return ("<"/*nonNLS*/+Util.bind("binding.implementation"/*nonNLS*/,new String(superInterfaces[0].readableName())) + ">"/*nonNLS*/).toCharArray(); + return ("<anonymous implementation of " + new String(superInterfaces[0].readableName()) + ">").toCharArray(); } else if (isMemberType()) { return CharOperation.concat(enclosingType().readableName(), sourceName, '.'); } else { @@ -78,10 +78,10 @@ } public String toString() { if (isAnonymousType()) - return "Anonymous type : "/*nonNLS*/ + super.toString(); + return "Anonymous type : " + super.toString(); if (isMemberType()) - return "Local member type : "/*nonNLS*/ + new String(sourceName()) + " "/*nonNLS*/ + super.toString(); - return "Local type : "/*nonNLS*/ + new String(sourceName()) + " "/*nonNLS*/ + super.toString(); + return "Local member type : " + new String(sourceName()) + " " + super.toString(); + return "Local type : " + new String(sourceName()) + " " + super.toString(); } /* Trigger the dependency mechanism forcing the innerclass emulation * to be propagated to all dependent source types.
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java index 0b0591e..6277750 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java
@@ -66,18 +66,18 @@ public String toString() { String s = super.toString(); if (!used) - s += "[pos: unused]"/*nonNLS*/; + s += "[pos: unused]"; else - s += "[pos: "/*nonNLS*/ + String.valueOf(resolvedPosition) + "]"/*nonNLS*/; - s += "[id:"/*nonNLS*/ + String.valueOf(id) + "]"/*nonNLS*/; + s += "[pos: " + String.valueOf(resolvedPosition) + "]"; + s += "[id:" + String.valueOf(id) + "]"; if (initializationCount > 0) { - s += "[pc: "/*nonNLS*/; + s += "[pc: "; for (int i = 0; i < initializationCount; i++) { if (i > 0) - s += ", "/*nonNLS*/; - s += String.valueOf(initializationPCs[i << 1]) + "-"/*nonNLS*/ + ((initializationPCs[(i << 1) + 1] == -1) ? "?"/*nonNLS*/ : String.valueOf(initializationPCs[(i<< 1) + 1])); + s += ", "; + s += String.valueOf(initializationPCs[i << 1]) + "-" + ((initializationPCs[(i << 1) + 1] == -1) ? "?" : String.valueOf(initializationPCs[(i<< 1) + 1])); } - s += "]"/*nonNLS*/; + s += "]"; } return s; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java index 27b863a..d804148 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
@@ -505,7 +505,7 @@ binding = ShortBinding; break; default : - throw new Error(Util.bind("error.undefinedBaseType"/*nonNLS*/,String.valueOf(signature[start]))); + throw new Error("Undefined base type: " + signature[start]); } } else { binding = getTypeFromConstantPoolName(signature, start + 1, end - 1);
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java index 8002aba..1d7b919 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java
@@ -28,6 +28,6 @@ return constantPoolName = CharOperation.concat(enclosingType().constantPoolName(), sourceName, '$'); } public String toString() { - return "Member type : "/*nonNLS*/ + new String(sourceName()) + " "/*nonNLS*/ + super.toString(); + return "Member type : " + new String(sourceName()) + " " + super.toString(); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java index 65b5ec8..1602f86 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
@@ -309,7 +309,7 @@ if (parameters != NoParameters) { for (int i = 0, length = parameters.length; i < length; i++) { if (i > 0) - buffer.append(", "/*nonNLS*/); + buffer.append(", "); buffer.append(parameters[i].sourceName()); } } @@ -387,35 +387,35 @@ modifiers |= AccClearPrivateModifier; } public String toString() { - String s = (returnType != null) ? returnType.debugName() : "NULL TYPE"/*nonNLS*/; - s += " "/*nonNLS*/; - s += (selector != null) ? new String(selector) : "UNNAMED METHOD"/*nonNLS*/; + String s = (returnType != null) ? returnType.debugName() : "NULL TYPE"; + s += " "; + s += (selector != null) ? new String(selector) : "UNNAMED METHOD"; - s += "("/*nonNLS*/; + s += "("; if (parameters != null) { if (parameters != NoParameters) { for (int i = 0, length = parameters.length; i < length; i++) { if (i > 0) - s += ", "/*nonNLS*/; - s += (parameters[i] != null) ? parameters[i].debugName() : "NULL TYPE"/*nonNLS*/; + s += ", "; + s += (parameters[i] != null) ? parameters[i].debugName() : "NULL TYPE"; } } } else { - s += "NULL PARAMETERS"/*nonNLS*/; + s += "NULL PARAMETERS"; } - s += ") "/*nonNLS*/; + s += ") "; if (thrownExceptions != null) { if (thrownExceptions != NoExceptions) { - s += "throws "/*nonNLS*/; + s += "throws "; for (int i = 0, length = thrownExceptions.length; i < length; i++) { if (i > 0) - s += ", "/*nonNLS*/; - s += (thrownExceptions[i] != null) ? thrownExceptions[i].debugName() : "NULL TYPE"/*nonNLS*/; + s += ", "; + s += (thrownExceptions[i] != null) ? thrownExceptions[i].debugName() : "NULL TYPE"; } } } else { - s += "NULL THROWN EXCEPTIONS"/*nonNLS*/; + s += "NULL THROWN EXCEPTIONS"; } return s; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java index 9c9f9df..f78d47f 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java
@@ -42,18 +42,18 @@ this.startIndex = 0; } String basicToString(int tab) { - String newLine = "\n"/*nonNLS*/; + String newLine = "\n"; for (int i = tab; --i >= 0;) - newLine += "\t"/*nonNLS*/; + newLine += "\t"; - String s = newLine + "--- Method Scope ---"/*nonNLS*/; - newLine += "\t"/*nonNLS*/; - s += newLine + "locals:"/*nonNLS*/; + String s = newLine + "--- Method Scope ---"; + newLine += "\t"; + s += newLine + "locals:"; for (int i = 0; i < localIndex; i++) - s += newLine + "\t"/*nonNLS*/ + locals[i].toString(); - s += newLine + "startIndex = "/*nonNLS*/ + startIndex; - s += newLine + "isConstructorCall = "/*nonNLS*/ + isConstructorCall; - s += newLine + "fieldDeclarationIndex = "/*nonNLS*/ + fieldDeclarationIndex; + s += newLine + "\t" + locals[i].toString(); + s += newLine + "startIndex = " + startIndex; + s += newLine + "isConstructorCall = " + isConstructorCall; + s += newLine + "fieldDeclarationIndex = " + fieldDeclarationIndex; return s; } /* Spec : 8.4.3 & 9.4
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java index 41da914..6c57e49 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java
@@ -148,6 +148,27 @@ return outerLocalVariables[i]; return null; } +/* Answer the synthetic argument for <targetEnclosingType> or null if one does not exist. +*/ + +public SyntheticArgumentBinding getSyntheticArgument(ReferenceBinding targetEnclosingType, BlockScope scope) { + if (enclosingInstances == null) return null; // is null if no enclosing instances are known + + // exact match + for (int i = enclosingInstances.length; --i >= 0;) + if (enclosingInstances[i].type == targetEnclosingType) + if (enclosingInstances[i].actualOuterLocalVariable == null) + return enclosingInstances[i]; + + // type compatibility : to handle cases such as + // class T { class M{}} + // class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N(). + for (int i = enclosingInstances.length; --i >= 0;) + if (enclosingInstances[i].actualOuterLocalVariable == null) + if (targetEnclosingType.isSuperclassOf((ReferenceBinding) enclosingInstances[i].type)) + return enclosingInstances[i]; + return null; +} public SyntheticArgumentBinding[] syntheticEnclosingInstances() { return enclosingInstances; // is null if no enclosing instances are required } @@ -171,28 +192,4 @@ public void updateInnerEmulationDependents() { // nothing to do in general, only local types are doing anything } - -/* Answer the synthetic argument for <targetEnclosingType> or null if one does not exist. -*/ - -public SyntheticArgumentBinding getSyntheticArgument(ReferenceBinding targetEnclosingType, BlockScope scope, boolean onlyExactMatch) { - if (enclosingInstances == null) return null; // is null if no enclosing instances are known - - // exact match - for (int i = enclosingInstances.length; --i >= 0;) - if (enclosingInstances[i].type == targetEnclosingType) - if (enclosingInstances[i].actualOuterLocalVariable == null) - return enclosingInstances[i]; - - // type compatibility : to handle cases such as - // class T { class M{}} - // class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N(). - if (!onlyExactMatch){ - for (int i = enclosingInstances.length; --i >= 0;) - if (enclosingInstances[i].actualOuterLocalVariable == null) - if (targetEnclosingType.isSuperclassOf((ReferenceBinding) enclosingInstances[i].type)) - return enclosingInstances[i]; - } - return null; -} }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java index a031167..a18137c 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java
@@ -190,8 +190,8 @@ } public String toString() { if (compoundName == NoCharChar) - return "The Default Package"/*nonNLS*/; + return "The Default Package"; else - return "package "/*nonNLS*/ + ((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED"/*nonNLS*/); + return "package " + ((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED"); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java index c512655..b905c71 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class ProblemMethodBinding extends MethodBinding { private int problemId;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java index 4e9e814..8dfb4f1 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class ProblemPackageBinding extends PackageBinding { private int problemId;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java index e98881d..27991d4 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface ProblemReasons { final int NoError = 0;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java index 2122549..8b1097e 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public class ProblemReferenceBinding extends ReferenceBinding { private int problemId;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java index 9fffaee..19f1c8d 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
@@ -265,7 +265,7 @@ return constantPoolName = CharOperation.concatWith(compoundName, '/'); } String debugName() { - return (compoundName != null) ? new String(readableName()) : "UNNAMED TYPE"/*nonNLS*/; + return (compoundName != null) ? new String(readableName()) : "UNNAMED TYPE"; } public final int depth() { int depth = 0;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java index 4f1f13b..7794ad1 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -118,7 +118,7 @@ synthField.name = CharOperation.concat( SyntheticArgumentBinding.OuterLocalPrefix, actualOuterLocalVariable.name, - ("$"/*nonNLS*/ + String.valueOf(index++)).toCharArray()); + ("$" + String.valueOf(index++)).toCharArray()); needRecheck = true; break; } @@ -176,7 +176,7 @@ FieldBinding synthField = (FieldBinding) synthetics[CLASS_LITERAL].get(targetType); if (synthField == null) { synthField = new SyntheticFieldBinding( - ("class$"/*nonNLS*/ + synthetics[CLASS_LITERAL].size()).toCharArray(), + ("class$" + synthetics[CLASS_LITERAL].size()).toCharArray(), blockScope.getJavaLangClass(), AccDefault | AccStatic | AccSynthetic, this, @@ -488,6 +488,30 @@ return (FieldBinding) synthetics[FIELD].get(actualOuterLocalVariable); } +/* Answer the synthetic field for <targetEnclosingType> +* or null if one does not exist. +*/ + +public FieldBinding getSyntheticField(ReferenceBinding targetEnclosingType, BlockScope scope) { + if (synthetics == null) + return null; + + FieldBinding field = (FieldBinding) synthetics[FIELD].get(targetEnclosingType); + if (field != null) + return field; + + // type compatibility : to handle cases such as + // class T { class M{}} + // class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N(). + Enumeration enum = synthetics[FIELD].elements(); + while (enum.hasMoreElements()) { + field = (FieldBinding) enum.nextElement(); + if (CharOperation.startsWith(field.name, SyntheticArgumentBinding.EnclosingInstancePrefix) + && targetEnclosingType.isSuperclassOf((ReferenceBinding) field.type)) + return field; + } + return null; +} public ReferenceBinding[] memberTypes() { return memberTypes; } @@ -732,71 +756,71 @@ return bindings; } public String toString() { - String s = "(id="/*nonNLS*/+(id == NoId ? "NoId"/*nonNLS*/ : (""/*nonNLS*/+id) ) +")\n"/*nonNLS*/; + String s = "(id="+(id == NoId ? "NoId" : (""+id) ) +")\n"; - if (isDeprecated()) s += "deprecated "/*nonNLS*/; - if (isPublic()) s += "public "/*nonNLS*/; - if (isProtected()) s += "protected "/*nonNLS*/; - if (isPrivate()) s += "private "/*nonNLS*/; - if (isAbstract() && isClass()) s += "abstract "/*nonNLS*/; - if (isStatic() && isNestedType()) s += "static "/*nonNLS*/; - if (isFinal()) s += "final "/*nonNLS*/; + if (isDeprecated()) s += "deprecated "; + if (isPublic()) s += "public "; + if (isProtected()) s += "protected "; + if (isPrivate()) s += "private "; + if (isAbstract() && isClass()) s += "abstract "; + if (isStatic() && isNestedType()) s += "static "; + if (isFinal()) s += "final "; - s += isInterface() ? "interface "/*nonNLS*/ : "class "/*nonNLS*/; - s += (compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED TYPE"/*nonNLS*/; + s += isInterface() ? "interface " : "class "; + s += (compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED TYPE"; - s += "\n\textends "/*nonNLS*/; - s += (superclass != null) ? superclass.debugName() : "NULL TYPE"/*nonNLS*/; + s += "\n\textends "; + s += (superclass != null) ? superclass.debugName() : "NULL TYPE"; if (superInterfaces != null) { if (superInterfaces != NoSuperInterfaces) { - s += "\n\timplements : "/*nonNLS*/; + s += "\n\timplements : "; for (int i = 0, length = superInterfaces.length; i < length; i++) { if (i > 0) - s += ", "/*nonNLS*/; - s += (superInterfaces[i] != null) ? superInterfaces[i].debugName() : "NULL TYPE"/*nonNLS*/; + s += ", "; + s += (superInterfaces[i] != null) ? superInterfaces[i].debugName() : "NULL TYPE"; } } } else { - s += "NULL SUPERINTERFACES"/*nonNLS*/; + s += "NULL SUPERINTERFACES"; } if (enclosingType() != null) { - s += "\n\tenclosing type : "/*nonNLS*/; + s += "\n\tenclosing type : "; s += enclosingType().debugName(); } if (fields != null) { if (fields != NoFields) { - s += "\n/* fields */"/*nonNLS*/; + s += "\n/* fields */"; for (int i = 0, length = fields.length; i < length; i++) - s += (fields[i] != null) ? "\n"/*nonNLS*/ + fields[i].toString() : "\nNULL FIELD"/*nonNLS*/; + s += (fields[i] != null) ? "\n" + fields[i].toString() : "\nNULL FIELD"; } } else { - s += "NULL FIELDS"/*nonNLS*/; + s += "NULL FIELDS"; } if (methods != null) { if (methods != NoMethods) { - s += "\n/* methods */"/*nonNLS*/; + s += "\n/* methods */"; for (int i = 0, length = methods.length; i < length; i++) - s += (methods[i] != null) ? "\n"/*nonNLS*/ + methods[i].toString() : "\nNULL METHOD"/*nonNLS*/; + s += (methods[i] != null) ? "\n" + methods[i].toString() : "\nNULL METHOD"; } } else { - s += "NULL METHODS"/*nonNLS*/; + s += "NULL METHODS"; } if (memberTypes != null) { if (memberTypes != NoMemberTypes) { - s += "\n/* members */"/*nonNLS*/; + s += "\n/* members */"; for (int i = 0, length = memberTypes.length; i < length; i++) - s += (memberTypes[i] != null) ? "\n"/*nonNLS*/ + memberTypes[i].toString() : "\nNULL TYPE"/*nonNLS*/; + s += (memberTypes[i] != null) ? "\n" + memberTypes[i].toString() : "\nNULL TYPE"; } } else { - s += "NULL MEMBER TYPES"/*nonNLS*/; + s += "NULL MEMBER TYPES"; } - s += "\n\n\n"/*nonNLS*/; + s += "\n\n\n"; return s; } void verifyMethods(MethodVerifier verifier) { @@ -805,30 +829,4 @@ for (int i = memberTypes.length; --i >= 0;) ((SourceTypeBinding) memberTypes[i]).verifyMethods(verifier); } - -/* Answer the synthetic field for <targetEnclosingType> -* or null if one does not exist. -*/ - -public FieldBinding getSyntheticField(ReferenceBinding targetEnclosingType, BlockScope scope, boolean onlyExactMatch) { - if (synthetics == null) - return null; - - FieldBinding field = (FieldBinding) synthetics[FIELD].get(targetEnclosingType); - if (field != null) return field; - - // type compatibility : to handle cases such as - // class T { class M{}} - // class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N(). - if (!onlyExactMatch){ - Enumeration enum = synthetics[FIELD].elements(); - while (enum.hasMoreElements()) { - field = (FieldBinding) enum.nextElement(); - if (CharOperation.startsWith(field.name, SyntheticArgumentBinding.EnclosingInstancePrefix) - && targetEnclosingType.isSuperclassOf((ReferenceBinding) field.type)) - return field; - } - } - return null; -} }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java index 871bb13..bf719ef 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface TagBits { // Tag bits in the tagBits int of every TypeBinding
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java index 426ca5f..4d0a05b 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
@@ -1,40 +1,25 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; -/* - * Not all fields defined by this type (& its subclasses) are initialized when it is created. - * Some are initialized only when needed. - * - * Accessors have been provided for some public fields so all TypeBindings have the same API... - * but access public fields directly whenever possible. - * Non-public fields have accessors which should be used everywhere you expect the field to be initialized. - * - * null is NOT a valid value for a non-public field... it just means the field is not initialized. - */ abstract public class TypeBinding extends Binding implements BaseTypes, TagBits, TypeConstants, TypeIds { public int id = NoId; public int tagBits = 0; // See values in the interface TagBits below /* API - * Answer the receiver's binding type from Binding.BindingID. - */ +* Answer the receiver's binding type from Binding.BindingID. +*/ public final int bindingType() { return TYPE; } /* Answer true if the receiver can be instantiated - */ +*/ public boolean canBeInstantiated() { return !isBaseType(); } /* Answer the receiver's constant pool name. - * - * NOTE: This method should only be used during/after code gen. - */ +* +* NOTE: This method should only be used during/after code gen. +*/ public abstract char[] constantPoolName(); /* java/lang/Object */ String debugName() {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java index cef8fc3..2924906 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface TypeConstants { final char[] JAVA = new char[] {'j', 'a', 'v', 'a'}; @@ -32,15 +27,15 @@ final char[][] JAVA_LANG_REFLECT_CONSTRUCTOR = new char[][] {JAVA, LANG, REFLECT, {'C', 'o', 'n', 's', 't', 'r', 'u', 'c', 't', 'o', 'r'}}; final char[][] JAVA_IO_PRINTSTREAM = new char[][] {JAVA, IO, {'P', 'r', 'i', 'n', 't', 'S', 't', 'r', 'e', 'a', 'm'}}; final char[][] JAVA_IO_SERIALIZABLE = new char[][] {JAVA, IO, {'S', 'e', 'r', 'i', 'a', 'l', 'i', 'z', 'a', 'b', 'l', 'e'}}; - final char[][] JAVA_LANG_BYTE = new char[][] {JAVA, LANG, "Byte"/*nonNLS*/.toCharArray()}; - final char[][] JAVA_LANG_SHORT = new char[][] {JAVA, LANG, "Short"/*nonNLS*/.toCharArray()}; - final char[][] JAVA_LANG_CHARACTER = new char[][] {JAVA, LANG, "Character"/*nonNLS*/.toCharArray()}; - final char[][] JAVA_LANG_INTEGER = new char[][] {JAVA, LANG, "Integer"/*nonNLS*/.toCharArray()}; - final char[][] JAVA_LANG_LONG = new char[][] {JAVA, LANG, "Long"/*nonNLS*/.toCharArray()}; - final char[][] JAVA_LANG_FLOAT = new char[][] {JAVA, LANG, "Float"/*nonNLS*/.toCharArray()}; - final char[][] JAVA_LANG_DOUBLE = new char[][] {JAVA, LANG, "Double"/*nonNLS*/.toCharArray()}; - final char[][] JAVA_LANG_BOOLEAN = new char[][] {JAVA, LANG, "Boolean"/*nonNLS*/.toCharArray()}; - final char[][] JAVA_LANG_VOID = new char[][] {JAVA, LANG, "Void"/*nonNLS*/.toCharArray()}; + final char[][] JAVA_LANG_BYTE = new char[][] {JAVA, LANG, "Byte".toCharArray()}; + final char[][] JAVA_LANG_SHORT = new char[][] {JAVA, LANG, "Short".toCharArray()}; + final char[][] JAVA_LANG_CHARACTER = new char[][] {JAVA, LANG, "Character".toCharArray()}; + final char[][] JAVA_LANG_INTEGER = new char[][] {JAVA, LANG, "Integer".toCharArray()}; + final char[][] JAVA_LANG_LONG = new char[][] {JAVA, LANG, "Long".toCharArray()}; + final char[][] JAVA_LANG_FLOAT = new char[][] {JAVA, LANG, "Float".toCharArray()}; + final char[][] JAVA_LANG_DOUBLE = new char[][] {JAVA, LANG, "Double".toCharArray()}; + final char[][] JAVA_LANG_BOOLEAN = new char[][] {JAVA, LANG, "Boolean".toCharArray()}; + final char[][] JAVA_LANG_VOID = new char[][] {JAVA, LANG, "Void".toCharArray()}; // Constants used by the flow analysis final int EqualOrMoreSpecific = -1;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java index 8647522..3b9bbf1 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface TypeIds { //base type void null undefined Object String
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java index 0ad1bf1..0c2c1b8 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java
@@ -32,6 +32,6 @@ return null; // will not get here since the above error aborts the compilation } public String toString() { - return "Unresolved type "/*nonNLS*/ + ((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED"/*nonNLS*/); + return "Unresolved type " + ((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED"); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java index 6bdad12..2fe4d61 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java +++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java
@@ -26,9 +26,9 @@ return name; } public String toString() { - String s = (type != null) ? type.debugName() : "UNDEFINED TYPE"/*nonNLS*/; - s += " "/*nonNLS*/; - s += (name != null) ? new String(name) : "UNNAMED FIELD"/*nonNLS*/; + String s = (type != null) ? type.debugName() : "UNDEFINED TYPE"; + s += " "; + s += (name != null) ? new String(name) : "UNNAMED FIELD"; return s; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java index 0312605..28727fe 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -114,238 +114,238 @@ public static char asb[] = null; public static char asr[] = null; public static char symbol_index[] = null; - private static final String UNEXPECTED_EOF = "Unexpected End Of File"/*nonNLS*/ ; + private static final String UNEXPECTED_EOF = "Unexpected End Of File" ; public final static String name[] = { null, - "++"/*nonNLS*/, - "--"/*nonNLS*/, - "=="/*nonNLS*/, - "<="/*nonNLS*/, - ">="/*nonNLS*/, - "!="/*nonNLS*/, - "<<"/*nonNLS*/, - ">>"/*nonNLS*/, - ">>>"/*nonNLS*/, - "+="/*nonNLS*/, - "-="/*nonNLS*/, - "*="/*nonNLS*/, - "/="/*nonNLS*/, - "&="/*nonNLS*/, - "|="/*nonNLS*/, - "^="/*nonNLS*/, - "%="/*nonNLS*/, - "<<="/*nonNLS*/, - ">>="/*nonNLS*/, - ">>>="/*nonNLS*/, - "||"/*nonNLS*/, - "&&"/*nonNLS*/, - "+"/*nonNLS*/, - "-"/*nonNLS*/, - "!"/*nonNLS*/, - "%"/*nonNLS*/, - "^"/*nonNLS*/, - "&"/*nonNLS*/, - "*"/*nonNLS*/, - "|"/*nonNLS*/, - "~"/*nonNLS*/, - "/"/*nonNLS*/, - ">"/*nonNLS*/, - "<"/*nonNLS*/, - "("/*nonNLS*/, - ")"/*nonNLS*/, - "{"/*nonNLS*/, - "}"/*nonNLS*/, - "["/*nonNLS*/, - "]"/*nonNLS*/, - ";"/*nonNLS*/, - "?"/*nonNLS*/, - ":"/*nonNLS*/, - ","/*nonNLS*/, - "."/*nonNLS*/, - "="/*nonNLS*/, - ""/*nonNLS*/, - "$empty"/*nonNLS*/, - "Identifier"/*nonNLS*/, - "abstract"/*nonNLS*/, - "boolean"/*nonNLS*/, - "break"/*nonNLS*/, - "byte"/*nonNLS*/, - "case"/*nonNLS*/, - "catch"/*nonNLS*/, - "char"/*nonNLS*/, - "class"/*nonNLS*/, - "continue"/*nonNLS*/, - "default"/*nonNLS*/, - "do"/*nonNLS*/, - "double"/*nonNLS*/, - "else"/*nonNLS*/, - "extends"/*nonNLS*/, - "false"/*nonNLS*/, - "final"/*nonNLS*/, - "finally"/*nonNLS*/, - "float"/*nonNLS*/, - "for"/*nonNLS*/, - "if"/*nonNLS*/, - "implements"/*nonNLS*/, - "import"/*nonNLS*/, - "instanceof"/*nonNLS*/, - "int"/*nonNLS*/, - "interface"/*nonNLS*/, - "long"/*nonNLS*/, - "native"/*nonNLS*/, - "new"/*nonNLS*/, - "null"/*nonNLS*/, - "package"/*nonNLS*/, - "private"/*nonNLS*/, - "protected"/*nonNLS*/, - "public"/*nonNLS*/, - "return"/*nonNLS*/, - "short"/*nonNLS*/, - "static"/*nonNLS*/, - "strictfp"/*nonNLS*/, - "super"/*nonNLS*/, - "switch"/*nonNLS*/, - "synchronized"/*nonNLS*/, - "this"/*nonNLS*/, - "throw"/*nonNLS*/, - "throws"/*nonNLS*/, - "transient"/*nonNLS*/, - "true"/*nonNLS*/, - "try"/*nonNLS*/, - "void"/*nonNLS*/, - "volatile"/*nonNLS*/, - "while"/*nonNLS*/, - "IntegerLiteral"/*nonNLS*/, - "LongLiteral"/*nonNLS*/, - "FloatingPointLiteral"/*nonNLS*/, - "DoubleLiteral"/*nonNLS*/, - "CharacterLiteral"/*nonNLS*/, - "StringLiteral"/*nonNLS*/, + "++", + "--", + "==", + "<=", + ">=", + "!=", + "<<", + ">>", + ">>>", + "+=", + "-=", + "*=", + "/=", + "&=", + "|=", + "^=", + "%=", + "<<=", + ">>=", + ">>>=", + "||", + "&&", + "+", + "-", + "!", + "%", + "^", + "&", + "*", + "|", + "~", + "/", + ">", + "<", + "(", + ")", + "{", + "}", + "[", + "]", + ";", + "?", + ":", + ",", + ".", + "=", + "", + "$empty", + "Identifier", + "abstract", + "boolean", + "break", + "byte", + "case", + "catch", + "char", + "class", + "continue", + "default", + "do", + "double", + "else", + "extends", + "false", + "final", + "finally", + "float", + "for", + "if", + "implements", + "import", + "instanceof", + "int", + "interface", + "long", + "native", + "new", + "null", + "package", + "private", + "protected", + "public", + "return", + "short", + "static", + "strictfp", + "super", + "switch", + "synchronized", + "this", + "throw", + "throws", + "transient", + "true", + "try", + "void", + "volatile", + "while", + "IntegerLiteral", + "LongLiteral", + "FloatingPointLiteral", + "DoubleLiteral", + "CharacterLiteral", + "StringLiteral", UNEXPECTED_EOF, - "Invalid Character"/*nonNLS*/, - "Goal"/*nonNLS*/, - "MethodBody"/*nonNLS*/, - "ConstructorBody"/*nonNLS*/, - "StaticInitializer"/*nonNLS*/, - "ClassBodyDeclaration"/*nonNLS*/, - "Headers"/*nonNLS*/, - "BlockStatements"/*nonNLS*/, - "MethodPushModifiersHeader"/*nonNLS*/, - "CatchHeader"/*nonNLS*/, - "FieldDeclaration"/*nonNLS*/, - "ImportDeclaration"/*nonNLS*/, - "PackageDeclaration"/*nonNLS*/, - "TypeDeclaration"/*nonNLS*/, - "GenericMethodDeclaration"/*nonNLS*/, - "Expression"/*nonNLS*/, - "Type"/*nonNLS*/, - "PrimitiveType"/*nonNLS*/, - "ReferenceType"/*nonNLS*/, - "ClassOrInterfaceType"/*nonNLS*/, - "ArrayType"/*nonNLS*/, - "Name"/*nonNLS*/, - "Dims"/*nonNLS*/, - "ClassType"/*nonNLS*/, - "SimpleName"/*nonNLS*/, - "Header"/*nonNLS*/, - "ClassHeader"/*nonNLS*/, - "InterfaceHeader"/*nonNLS*/, - "MethodHeader"/*nonNLS*/, - "ConstructorHeader"/*nonNLS*/, - "FormalParameter"/*nonNLS*/, - "ImportDeclarations"/*nonNLS*/, - "TypeDeclarations"/*nonNLS*/, - "PackageDeclarationName"/*nonNLS*/, - "SingleTypeImportDeclarationNam"/*nonNLS*/ + - "e"/*nonNLS*/, - "TypeImportOnDemandDeclarationN"/*nonNLS*/ + - "ame"/*nonNLS*/, - "Modifiers"/*nonNLS*/, - "Modifier"/*nonNLS*/, - "ClassBody"/*nonNLS*/, - "ClassHeaderName"/*nonNLS*/, - "InterfaceTypeList"/*nonNLS*/, - "InterfaceType"/*nonNLS*/, - "ClassBodyDeclarations"/*nonNLS*/, - "Block"/*nonNLS*/, - "VariableDeclarators"/*nonNLS*/, - "VariableDeclarator"/*nonNLS*/, - "VariableDeclaratorId"/*nonNLS*/, - "VariableInitializer"/*nonNLS*/, - "ArrayInitializer"/*nonNLS*/, - "MethodHeaderName"/*nonNLS*/, - "MethodHeaderParameters"/*nonNLS*/, - "MethodPushModifiersHeaderName"/*nonNLS*/, - "ClassTypeList"/*nonNLS*/, - "ConstructorHeaderName"/*nonNLS*/, - "FormalParameterList"/*nonNLS*/, - "ClassTypeElt"/*nonNLS*/, - "StaticOnly"/*nonNLS*/, - "ExplicitConstructorInvocation"/*nonNLS*/, - "Primary"/*nonNLS*/, - "InterfaceBody"/*nonNLS*/, - "InterfaceHeaderName"/*nonNLS*/, - "InterfaceMemberDeclarations"/*nonNLS*/, - "InterfaceMemberDeclaration"/*nonNLS*/, - "VariableInitializers"/*nonNLS*/, - "BlockStatement"/*nonNLS*/, - "Statement"/*nonNLS*/, - "LocalVariableDeclaration"/*nonNLS*/, - "StatementWithoutTrailingSubsta"/*nonNLS*/ + - "tement"/*nonNLS*/, - "StatementNoShortIf"/*nonNLS*/, - "StatementExpression"/*nonNLS*/, - "PostIncrementExpression"/*nonNLS*/, - "PostDecrementExpression"/*nonNLS*/, - "MethodInvocation"/*nonNLS*/, - "ClassInstanceCreationExpressio"/*nonNLS*/ + - "n"/*nonNLS*/, - "SwitchBlock"/*nonNLS*/, - "SwitchBlockStatements"/*nonNLS*/, - "SwitchLabels"/*nonNLS*/, - "SwitchBlockStatement"/*nonNLS*/, - "SwitchLabel"/*nonNLS*/, - "ConstantExpression"/*nonNLS*/, - "StatementExpressionList"/*nonNLS*/, - "OnlySynchronized"/*nonNLS*/, - "Catches"/*nonNLS*/, - "Finally"/*nonNLS*/, - "CatchClause"/*nonNLS*/, - "PushLPAREN"/*nonNLS*/, - "PushRPAREN"/*nonNLS*/, - "PrimaryNoNewArray"/*nonNLS*/, - "FieldAccess"/*nonNLS*/, - "ArrayAccess"/*nonNLS*/, - "ClassInstanceCreationExpressio"/*nonNLS*/ + - "nName"/*nonNLS*/, - "ArgumentList"/*nonNLS*/, - "DimWithOrWithOutExprs"/*nonNLS*/, - "DimWithOrWithOutExpr"/*nonNLS*/, - "DimsLoop"/*nonNLS*/, - "OneDimLoop"/*nonNLS*/, - "PostfixExpression"/*nonNLS*/, - "UnaryExpression"/*nonNLS*/, - "UnaryExpressionNotPlusMinus"/*nonNLS*/, - "MultiplicativeExpression"/*nonNLS*/, - "AdditiveExpression"/*nonNLS*/, - "ShiftExpression"/*nonNLS*/, - "RelationalExpression"/*nonNLS*/, - "EqualityExpression"/*nonNLS*/, - "AndExpression"/*nonNLS*/, - "ExclusiveOrExpression"/*nonNLS*/, - "InclusiveOrExpression"/*nonNLS*/, - "ConditionalAndExpression"/*nonNLS*/, - "ConditionalOrExpression"/*nonNLS*/, - "ConditionalExpression"/*nonNLS*/, - "AssignmentExpression"/*nonNLS*/, - "LeftHandSide"/*nonNLS*/, - "AssignmentOperator"/*nonNLS*/ + "Invalid Character", + "Goal", + "MethodBody", + "ConstructorBody", + "StaticInitializer", + "ClassBodyDeclaration", + "Headers", + "BlockStatements", + "MethodPushModifiersHeader", + "CatchHeader", + "FieldDeclaration", + "ImportDeclaration", + "PackageDeclaration", + "TypeDeclaration", + "GenericMethodDeclaration", + "Expression", + "Type", + "PrimitiveType", + "ReferenceType", + "ClassOrInterfaceType", + "ArrayType", + "Name", + "Dims", + "ClassType", + "SimpleName", + "Header", + "ClassHeader", + "InterfaceHeader", + "MethodHeader", + "ConstructorHeader", + "FormalParameter", + "ImportDeclarations", + "TypeDeclarations", + "PackageDeclarationName", + "SingleTypeImportDeclarationNam" + + "e", + "TypeImportOnDemandDeclarationN" + + "ame", + "Modifiers", + "Modifier", + "ClassBody", + "ClassHeaderName", + "InterfaceTypeList", + "InterfaceType", + "ClassBodyDeclarations", + "Block", + "VariableDeclarators", + "VariableDeclarator", + "VariableDeclaratorId", + "VariableInitializer", + "ArrayInitializer", + "MethodHeaderName", + "MethodHeaderParameters", + "MethodPushModifiersHeaderName", + "ClassTypeList", + "ConstructorHeaderName", + "FormalParameterList", + "ClassTypeElt", + "StaticOnly", + "ExplicitConstructorInvocation", + "Primary", + "InterfaceBody", + "InterfaceHeaderName", + "InterfaceMemberDeclarations", + "InterfaceMemberDeclaration", + "VariableInitializers", + "BlockStatement", + "Statement", + "LocalVariableDeclaration", + "StatementWithoutTrailingSubsta" + + "tement", + "StatementNoShortIf", + "StatementExpression", + "PostIncrementExpression", + "PostDecrementExpression", + "MethodInvocation", + "ClassInstanceCreationExpressio" + + "n", + "SwitchBlock", + "SwitchBlockStatements", + "SwitchLabels", + "SwitchBlockStatement", + "SwitchLabel", + "ConstantExpression", + "StatementExpressionList", + "OnlySynchronized", + "Catches", + "Finally", + "CatchClause", + "PushLPAREN", + "PushRPAREN", + "PrimaryNoNewArray", + "FieldAccess", + "ArrayAccess", + "ClassInstanceCreationExpressio" + + "nName", + "ArgumentList", + "DimWithOrWithOutExprs", + "DimWithOrWithOutExpr", + "DimsLoop", + "OneDimLoop", + "PostfixExpression", + "UnaryExpression", + "UnaryExpressionNotPlusMinus", + "MultiplicativeExpression", + "AdditiveExpression", + "ShiftExpression", + "RelationalExpression", + "EqualityExpression", + "AndExpression", + "ExclusiveOrExpression", + "InclusiveOrExpression", + "ConditionalAndExpression", + "ConditionalOrExpression", + "ConditionalExpression", + "AssignmentExpression", + "LeftHandSide", + "AssignmentOperator" }; public static short check_table[] = null; public static char lhs[] = null; public static char action[] = lhs; - private final static String FILEPREFIX = "parser"/*nonNLS*/; + private final static String FILEPREFIX = "parser"; static { try{ @@ -428,7 +428,7 @@ char[] chars = new char[tokens.length]; //can't be bigger int ic = 0; String token; - while (!(token = tokens[i++]).equals("}"/*nonNLS*/)) { + while (!(token = tokens[i++]).equals("}")) { int c = Integer.parseInt(token); if (isShort) c += 32768; @@ -471,11 +471,11 @@ reader.read(contents, 0, contents.length); reader.close(); } catch (IOException ex) { - System.out.println(Util.bind("parser.incorrectPath"/*nonNLS*/)); + System.out.println("The path for the javadcl.java file is incorrect"); return; } java.util.StringTokenizer st = - new java.util.StringTokenizer(new String(contents), " \t\n\r[]={,;"/*nonNLS*/); + new java.util.StringTokenizer(new String(contents), " \t\n\r[]={,;"); String[] tokens = new String[st.countTokens()]; int i = 0; while (st.hasMoreTokens()) { @@ -483,12 +483,12 @@ } final String prefix = FILEPREFIX; i = 0; - buildFileFor(prefix + (++i) + ".rsc"/*nonNLS*/, "lhs"/*nonNLS*/, tokens, false); - buildFileFor(prefix + (++i) + ".rsc"/*nonNLS*/, "check_table"/*nonNLS*/, tokens, true); - buildFileFor(prefix + (++i) + ".rsc"/*nonNLS*/, "asb"/*nonNLS*/, tokens, false); - buildFileFor(prefix + (++i) + ".rsc"/*nonNLS*/, "asr"/*nonNLS*/, tokens, false); - buildFileFor(prefix + (++i) + ".rsc"/*nonNLS*/, "symbol_index"/*nonNLS*/, tokens, false); - System.out.println(Util.bind("parser.moveFiles"/*nonNLS*/)); + buildFileFor(prefix + (++i) + ".rsc", "lhs", tokens, false); + buildFileFor(prefix + (++i) + ".rsc", "check_table", tokens, true); + buildFileFor(prefix + (++i) + ".rsc", "asb", tokens, false); + buildFileFor(prefix + (++i) + ".rsc", "asr", tokens, false); + buildFileFor(prefix + (++i) + ".rsc", "symbol_index", tokens, false); + System.out.println("MOVE FILES IN THE Runtime DIRECTORY OF Parser.class"); } /* * Build initial recovery state. @@ -979,9 +979,9 @@ && (comment[i + 8] == 't') && (comment[i + 9] == 'e') && (comment[i + 10] == 'd')) { - // ensure the tag is properly ended: either followed by a space, a tab, line end or asterisk. + // ensure the tag is properly ended: either followed by a space, line end or asterisk. int nextPos = i+11; - deprecated = (comment[nextPos] == ' ') || (comment[nextPos] == '\t') || (comment[nextPos] == '\n') || (comment[nextPos] == '\r') || (comment[nextPos] == '*'); + deprecated = (comment[nextPos] == ' ') || (comment[nextPos] == '\n') || (comment[nextPos] == '\r') || (comment[nextPos] == '*'); break found; } } @@ -3934,12 +3934,11 @@ scanner.currentPosition - 1)); break; case TokenNameStringLiteral : - StringLiteral stringLiteral = new StringLiteral( + pushOnExpressionStack( + new StringLiteral( scanner.getCurrentTokenSourceString(), scanner.startPosition, - scanner.currentPosition - 1); - if (scanner.wasNonExternalizedStringLiteral) problemReporter().nonExternalizedStringLiteral(stringLiteral); - pushOnExpressionStack(stringLiteral); + scanner.currentPosition - 1)); break; case TokenNamefalse : pushOnExpressionStack( @@ -4293,17 +4292,15 @@ if (currentElement != null){ currentElement.topElement().updateParseTree(); if (VERBOSE_RECOVERY){ - System.out.print(Util.bind("parser.syntaxRecovery"/*nonNLS*/)); - System.out.println("--------------------------"/*nonNLS*/); + System.out.println("SYNTAX RECOVERY--------------------------"); System.out.println(compilationUnit); - System.out.println("----------------------------------"/*nonNLS*/); + System.out.println("----------------------------------"); } } else { if (diet & VERBOSE_RECOVERY){ - System.out.print(Util.bind("parser.regularParse"/*nonNLS*/)); - System.out.println("--------------------------"/*nonNLS*/); + System.out.println("REGULAR PARSE--------------------------"); System.out.println(compilationUnit); - System.out.println("----------------------------------"/*nonNLS*/); + System.out.println("----------------------------------"); } } if (scanner.recordLineSeparator) { @@ -6005,21 +6002,21 @@ lastErrorEndPosition = -1; } public void initializeScanner(){ - this.scanner = new Scanner(false, false, this.problemReporter.options.isNonExternalizedStringLiteralHandledAsWarning()); + this.scanner = new Scanner(); } public final static void initTables() throws java.io.IOException { final String prefix = FILEPREFIX; int i = 0; - lhs = readTable(prefix + (++i) + ".rsc"/*nonNLS*/); - char[] chars = readTable(prefix + (++i) + ".rsc"/*nonNLS*/); + lhs = readTable(prefix + (++i) + ".rsc"); + char[] chars = readTable(prefix + (++i) + ".rsc"); check_table = new short[chars.length]; for (int c = chars.length; c-- > 0;) { check_table[c] = (short) (chars[c] - 32768); } - asb = readTable(prefix + (++i) + ".rsc"/*nonNLS*/); - asr = readTable(prefix + (++i) + ".rsc"/*nonNLS*/); - symbol_index = readTable(prefix + (++i) + ".rsc"/*nonNLS*/); + asb = readTable(prefix + (++i) + ".rsc"); + asr = readTable(prefix + (++i) + ".rsc"); + symbol_index = readTable(prefix + (++i) + ".rsc"); action = lhs; } public final void jumpOverMethodBody() { @@ -6639,7 +6636,7 @@ InputStream stream = Parser.class.getResourceAsStream(filename); if (stream == null) { - throw new java.io.IOException(Util.bind("parser.missingFile"/*nonNLS*/,filename)); + throw new java.io.IOException("missing file" + filename); } ByteArrayOutputStream os = new ByteArrayOutputStream(32000); @@ -6657,7 +6654,7 @@ //minimal integrity check (even size expected) if (streamLength % 2 != 0) - throw new java.io.IOException(Util.bind("parser.corruptedFile"/*nonNLS*/,filename)); + throw new java.io.IOException("corrupted file " + filename); // convert bytes into chars char[] chars = new char[streamLength / 2]; @@ -6740,9 +6737,9 @@ } } else { //the next test is HEAVILY grammar DEPENDENT. if ((length == 2) - && (tokenName.equals(";"/*nonNLS*/)) - && (expectings[0] == "++"/*nonNLS*/) - && (expectings[1] == "--"/*nonNLS*/) + && (tokenName.equals(";")) + && (expectings[0] == "++") + && (expectings[1] == "--") && (expressionPtr > -1)) { // the ; is not the expected token ==> it ends a statement when an expression is not ended problemReporter().invalidExpressionAsStatement(expressionStack[expressionPtr]); @@ -6843,40 +6840,40 @@ } public String toString() { - String s = "identifierStack : char[][] = {"/*nonNLS*/; + String s = "identifierStack : char[][] = {"; for (int i = 0; i <= identifierPtr; i++) { - s = s + "\""/*nonNLS*/ + String.valueOf(identifierStack[i]) + "\","/*nonNLS*/; + s = s + "\"" + String.valueOf(identifierStack[i]) + "\","; }; - s = s + "}\n"/*nonNLS*/; + s = s + "}\n"; - s = s + "identierLengthStack : int[] = {"/*nonNLS*/; + s = s + "identierLengthStack : int[] = {"; for (int i = 0; i <= identifierLengthPtr; i++) { - s = s + identifierLengthStack[i] + ","/*nonNLS*/; + s = s + identifierLengthStack[i] + ","; }; - s = s + "}\n"/*nonNLS*/; + s = s + "}\n"; - s = s + "astLengthStack : int[] = {"/*nonNLS*/; + s = s + "astLengthStack : int[] = {"; for (int i = 0; i <= astLengthPtr; i++) { - s = s + astLengthStack[i] + ","/*nonNLS*/; + s = s + astLengthStack[i] + ","; }; - s = s + "}\n"/*nonNLS*/; - s = s + "astPtr : int = "/*nonNLS*/ + String.valueOf(astPtr) + "\n"/*nonNLS*/; + s = s + "}\n"; + s = s + "astPtr : int = " + String.valueOf(astPtr) + "\n"; - s = s + "intStack : int[] = {"/*nonNLS*/; + s = s + "intStack : int[] = {"; for (int i = 0; i <= intPtr; i++) { - s = s + intStack[i] + ","/*nonNLS*/; + s = s + intStack[i] + ","; }; - s = s + "}\n"/*nonNLS*/; + s = s + "}\n"; - s = s + "expressionLengthStack : int[] = {"/*nonNLS*/; + s = s + "expressionLengthStack : int[] = {"; for (int i = 0; i <= expressionLengthPtr; i++) { - s = s + expressionLengthStack[i] + ","/*nonNLS*/; + s = s + expressionLengthStack[i] + ","; }; - s = s + "}\n"/*nonNLS*/; + s = s + "}\n"; - s = s + "expressionPtr : int = "/*nonNLS*/ + String.valueOf(expressionPtr) + "\n"/*nonNLS*/; + s = s + "expressionPtr : int = " + String.valueOf(expressionPtr) + "\n"; - s = s + "\n\n\n----------------Scanner--------------\n"/*nonNLS*/ + scanner.toString(); + s = s + "\n\n\n----------------Scanner--------------\n" + scanner.toString(); return s; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java b/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java index 0606e3a..c233af7 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java
@@ -1,12 +1,4 @@ package org.eclipse.jdt.internal.compiler.parser; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; - -/*An interface that contains static declarations for some basic information - about the parser such as the number of rules in the grammar, the starting state, etc...*/ public interface ParserBasicInformation {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java index a26bdaa..79ee70c 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java
@@ -10,9 +10,7 @@ import org.eclipse.jdt.internal.compiler.ast.*; import org.eclipse.jdt.internal.compiler.lookup.*; -import org.eclipse.jdt.internal.compiler.util.CharOperation; - -public class RecoveredBlock extends RecoveredStatement implements CompilerModifiers, TerminalSymbols, BaseTypes { +public class RecoveredBlock extends RecoveredStatement implements CompilerModifiers, TerminalSymbols { public Block blockDeclaration; @@ -134,11 +132,11 @@ } public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); - result.append("Recovered block:\n"/*nonNLS*/); + result.append("Recovered block:\n"); result.append(blockDeclaration.toString(tab + 1)); if (this.statements != null) { for (int i = 0; i < this.statementCount; i++) { - result.append("\n"/*nonNLS*/); + result.append("\n"); result.append(this.statements[i].toString(tab + 1)); } } @@ -246,32 +244,4 @@ return blockDeclaration; } - -/* - * Record a field declaration - */ -public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalance) { - - /* local variables inside method can only be final and non void */ - char[][] fieldTypeName; - if ((fieldDeclaration.modifiers & ~AccFinal) != 0 /* local var can only be final */ - || (fieldDeclaration.type == null) // initializer - || ((fieldTypeName = fieldDeclaration.type.getTypeName()).length == 1 // non void - && CharOperation.equals(fieldTypeName[0], VoidBinding.sourceName()))){ - this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(fieldDeclaration.declarationSourceStart - 1)); - return this.parent.add(fieldDeclaration, bracketBalance); - } - - /* do not consider a local variable starting passed the block end (if set) - it must be belonging to an enclosing block */ - if (blockDeclaration.sourceEnd != 0 - && fieldDeclaration.declarationSourceStart > blockDeclaration.sourceEnd){ - return this.parent.add(fieldDeclaration, bracketBalance); - } - - // ignore the added field, since indicates a local variable behind recovery point - // which thus got parsed as a field reference. This can happen if restarting after - // having reduced an assistNode to get the following context (see 1GEK7SG) - return this; -} }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredElement.java b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredElement.java index 4de01e8..29408dc 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredElement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredElement.java
@@ -215,7 +215,7 @@ protected String tabString(int tab) { StringBuffer result = new StringBuffer(); for (int i = tab; i > 0; i--) { - result.append(" "/*nonNLS*/); + result.append(" "); } return result.toString(); }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java index 7d3800c..76f2ce1 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java
@@ -85,11 +85,11 @@ } public String toString(int tab){ StringBuffer buffer = new StringBuffer(tabString(tab)); - buffer.append("Recovered field:\n"/*nonNLS*/); + buffer.append("Recovered field:\n"); buffer.append(fieldDeclaration.toString(tab + 1)); if (this.anonymousTypes != null) { for (int i = 0; i < this.anonymousTypeCount; i++){ - buffer.append("\n"/*nonNLS*/); + buffer.append("\n"); buffer.append(anonymousTypes[i].toString(tab + 1)); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredImport.java b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredImport.java index 139dead..25c3e0a 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredImport.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredImport.java
@@ -29,7 +29,7 @@ return this.importReference.declarationSourceEnd; } public String toString(int tab) { - return tabString(tab) + "Recovered import: "/*nonNLS*/ + importReference.toString(); + return tabString(tab) + "Recovered import: " + importReference.toString(); } public ImportReference updatedImportReference(){
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java index 36f41b9..d0fdfba 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java
@@ -161,10 +161,10 @@ } public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); - result.append("Recovered initializer:\n"/*nonNLS*/); + result.append("Recovered initializer:\n"); result.append(this.fieldDeclaration.toString(tab + 1)); if (this.initializerBody != null) { - result.append("\n"/*nonNLS*/); + result.append("\n"); result.append(this.initializerBody.toString(tab + 1)); } return result.toString();
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java index 3d3df3a..12e14e8 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java
@@ -31,7 +31,7 @@ return this.localDeclaration.declarationSourceEnd; } public String toString(int tab) { - return tabString(tab) + "Recovered local variable:\n"/*nonNLS*/ + localDeclaration.toString(tab + 1); + return tabString(tab) + "Recovered local variable:\n" + localDeclaration.toString(tab + 1); } public Statement updatedStatement(){ return localDeclaration;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java index d330454..a17a552 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java
@@ -189,16 +189,16 @@ } public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); - result.append("Recovered method:\n"/*nonNLS*/); + result.append("Recovered method:\n"); result.append(this.methodDeclaration.toString(tab + 1)); if (this.localTypes != null) { for (int i = 0; i < this.localTypeCount; i++) { - result.append("\n"/*nonNLS*/); + result.append("\n"); result.append(this.localTypes[i].toString(tab + 1)); } } if (this.methodBody != null) { - result.append("\n"/*nonNLS*/); + result.append("\n"); result.append(this.methodBody.toString(tab + 1)); } return result.toString();
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java index 48be014..5a4d6c7 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java
@@ -30,7 +30,7 @@ return this.statement.sourceEnd; } public String toString(int tab){ - return tabString(tab) + "Recovered statement:\n"/*nonNLS*/ + statement.toString(tab + 1); + return tabString(tab) + "Recovered statement:\n" + statement.toString(tab + 1); } public Statement updatedStatement(){ return statement;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java index e1bc17f..d39519b 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java
@@ -185,27 +185,27 @@ } public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); - result.append("Recovered type:\n"/*nonNLS*/); + result.append("Recovered type:\n"); if (typeDeclaration instanceof AnonymousLocalTypeDeclaration) { result.append(tabString(tab)); - result.append(" "/*nonNLS*/); + result.append(" "); } result.append(typeDeclaration.toString(tab + 1)); if (this.memberTypes != null) { for (int i = 0; i < this.memberTypeCount; i++) { - result.append("\n"/*nonNLS*/); + result.append("\n"); result.append(this.memberTypes[i].toString(tab + 1)); } } if (this.fields != null) { for (int i = 0; i < this.fieldCount; i++) { - result.append("\n"/*nonNLS*/); + result.append("\n"); result.append(this.fields[i].toString(tab + 1)); } } if (this.methods != null) { for (int i = 0; i < this.methodCount; i++) { - result.append("\n"/*nonNLS*/); + result.append("\n"); result.append(this.methods[i].toString(tab + 1)); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java index eb67804..b206d69 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java
@@ -106,19 +106,19 @@ } public String toString(int tab) { StringBuffer result = new StringBuffer(tabString(tab)); - result.append("Recovered unit: [\n"/*nonNLS*/); + result.append("Recovered unit: [\n"); result.append(unitDeclaration.toString(tab + 1)); result.append(tabString(tab + 1)); - result.append("]"/*nonNLS*/); + result.append("]"); if (this.imports != null) { for (int i = 0; i < this.importCount; i++) { - result.append("\n"/*nonNLS*/); + result.append("\n"); result.append(this.imports[i].toString(tab + 1)); } } if (this.types != null) { for (int i = 0; i < this.typeCount; i++) { - result.append("\n"/*nonNLS*/); + result.append("\n"); result.append(this.types[i].toString(tab + 1)); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java index fb62e9a..c656316 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -62,21 +62,21 @@ public int linePtr = -1; public boolean wasAcr = false; - public static final String END_OF_SOURCE = "End_Of_Source"/*nonNLS*/; + public static final String END_OF_SOURCE = "End_Of_Source"; - public static final String INVALID_HEXA = "Invalid_Hexa_Literal"/*nonNLS*/; - public static final String INVALID_OCTAL = "Invalid_Octal_Literal"/*nonNLS*/; + public static final String INVALID_HEXA = "Invalid_Hexa_Literal"; + public static final String INVALID_OCTAL = "Invalid_Octal_Literal"; public static final String INVALID_CHARACTER_CONSTANT = - "Invalid_Character_Constant"/*nonNLS*/; - public static final String INVALID_ESCAPE = "Invalid_Escape"/*nonNLS*/; - public static final String INVALID_INPUT = "Invalid_Input"/*nonNLS*/; - public static final String INVALID_UNICODE_ESCAPE = "Invalid_Unicode_Escape"/*nonNLS*/; - public static final String INVALID_FLOAT = "Invalid_Float_Literal"/*nonNLS*/; + "Invalid_Character_Constant"; + public static final String INVALID_ESCAPE = "Invalid_Escape"; + public static final String INVALID_INPUT = "Invalid_Input"; + public static final String INVALID_UNICODE_ESCAPE = "Invalid_Unicode_Escape"; + public static final String INVALID_FLOAT = "Invalid_Float_Literal"; - public static final String NULL_SOURCE_STRING = "Null_Source_String"/*nonNLS*/; - public static final String UNTERMINATED_STRING = "Unterminated_String"/*nonNLS*/; - public static final String UNTERMINATED_COMMENT = "Unterminated_Comment"/*nonNLS*/; - public static final String INVALID_CHAR_IN_STRING = "Invalid_Char_In_String"/*nonNLS*/; + public static final String NULL_SOURCE_STRING = "Null_Source_String"; + public static final String UNTERMINATED_STRING = "Unterminated_String"; + public static final String UNTERMINATED_COMMENT = "Unterminated_Comment"; + public static final String INVALID_CHAR_IN_STRING = "Invalid_Char_In_String"; //----------------optimized identifier managment------------------ static final char[] charArray_a = new char[] {'a'}, @@ -112,10 +112,6 @@ public static final int OptimizedLength = 6; public /*static*/ final char[][][][] charArray_length = new char[OptimizedLength][TableSize][InternalTableSize][]; - // support for detecting non-externalized string literals - public boolean checkNonExternalizedStringLiterals = true; - public static char[] NonNLS_TAG = "/*nonNLS*/"/*nonNLS*/.toCharArray(); - public boolean wasNonExternalizedStringLiteral = false; /*static*/ { for (int i = 0; i < 6; i++) { for (int j = 0; j < TableSize; j++) { @@ -139,7 +135,9 @@ this(false, false); } public Scanner(boolean tokenizeComments, boolean tokenizeWhiteSpace) { - this(tokenizeComments, tokenizeWhiteSpace, false); + this.eofPosition = Integer.MAX_VALUE; + this.tokenizeComments = tokenizeComments; + this.tokenizeWhiteSpace = tokenizeWhiteSpace; } public final boolean atEnd() { // This code is not relevant if source is @@ -915,16 +913,6 @@ } throw e; // rethrow } - if (checkNonExternalizedStringLiterals){ // check for presence of /*nonNLS*/ - int lookAhead = 0; - for (; lookAhead < 10; lookAhead++){ - if (currentPosition + lookAhead == source.length) - break; - if (source[currentPosition + lookAhead] != NonNLS_TAG[lookAhead]) - break; - } - this.wasNonExternalizedStringLiteral = lookAhead != 10; - } return TokenNameStringLiteral; case '/' : { @@ -1084,7 +1072,7 @@ if (atEnd()) return TokenNameEOF; //the atEnd may not be <currentPosition == source.length> if source is only some part of a real (external) stream - throw new InvalidInputException("Ctrl-Z"/*nonNLS*/); + throw new InvalidInputException("Ctrl-Z"); default : if (Character.isJavaIdentifierStart(currentCharacter)) @@ -1419,37 +1407,33 @@ //On false, the currentCharacter is filled up with a potential //correct char - try { - int c1, c2, c3, c4; - int unicodeSize = 6; + int c1, c2, c3, c4; + int unicodeSize = 6; + currentPosition++; + while (source[currentPosition] == 'u') { currentPosition++; - while (source[currentPosition] == 'u') { - currentPosition++; - unicodeSize++; - } + unicodeSize++; + } - if (((c1 = Character.getNumericValue(source[currentPosition++])) > 15 - || c1 < 0) - || ((c2 = Character.getNumericValue(source[currentPosition++])) > 15 || c2 < 0) - || ((c3 = Character.getNumericValue(source[currentPosition++])) > 15 || c3 < 0) - || ((c4 = Character.getNumericValue(source[currentPosition++])) > 15 || c4 < 0)) { - throw new InvalidInputException(INVALID_UNICODE_ESCAPE); - } - - currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4); - if (recordLineSeparator - && ((currentCharacter == '\r') || (currentCharacter == '\n'))) - pushLineSeparator(); - if (Character.isWhitespace(currentCharacter)) - return true; - - //buffer the new char which is not a white space - withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; - //withoutUnicodePtr == 1 is true here - return false; - } catch (IndexOutOfBoundsException e){ + if (((c1 = Character.getNumericValue(source[currentPosition++])) > 15 + || c1 < 0) + || ((c2 = Character.getNumericValue(source[currentPosition++])) > 15 || c2 < 0) + || ((c3 = Character.getNumericValue(source[currentPosition++])) > 15 || c3 < 0) + || ((c4 = Character.getNumericValue(source[currentPosition++])) > 15 || c4 < 0)) { throw new InvalidInputException(INVALID_UNICODE_ESCAPE); } + + currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4); + if (recordLineSeparator + && ((currentCharacter == '\r') || (currentCharacter == '\n'))) + pushLineSeparator(); + if (Character.isWhitespace(currentCharacter)) + return true; + + //buffer the new char which is not a white space + withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; + //withoutUnicodePtr == 1 is true here + return false; } public final int[] lineEnds() { //return a bounded copy of this.lineEnds @@ -2653,9 +2637,9 @@ } public String toString() { if (startPosition == source.length) - return "EOF\n\n"/*nonNLS*/ + new String(source); + return "EOF\n\n" + new String(source); if (currentPosition > source.length) - return "behind the EOF :-( ....\n\n"/*nonNLS*/ + new String(source); + return "behind the EOF :-( ....\n\n" + new String(source); char front[] = new char[startPosition]; System.arraycopy(source, 0, front, 0, startPosition); @@ -2683,228 +2667,221 @@ source.length - (currentPosition - 1) - 1); return new String(front) - + "\n===============================\nStarts here -->"/*nonNLS*/ + + "\n===============================\nStarts here -->" + new String(middle) - + "<-- Ends here\n===============================\n"/*nonNLS*/ + + "<-- Ends here\n===============================\n" + new String(end); } public final String toStringAction(int act) { switch (act) { case TokenNameIdentifier : - return "Identifier("/*nonNLS*/ + new String(getCurrentTokenSource()) + ")"/*nonNLS*/; + return "Identifier(" + new String(getCurrentTokenSource()) + ")"; case TokenNameabstract : - return "abstract"/*nonNLS*/; + return "abstract"; case TokenNameboolean : - return "boolean"/*nonNLS*/; + return "boolean"; case TokenNamebreak : - return "break"/*nonNLS*/; + return "break"; case TokenNamebyte : - return "byte"/*nonNLS*/; + return "byte"; case TokenNamecase : - return "case"/*nonNLS*/; + return "case"; case TokenNamecatch : - return "catch"/*nonNLS*/; + return "catch"; case TokenNamechar : - return "char"/*nonNLS*/; + return "char"; case TokenNameclass : - return "class"/*nonNLS*/; + return "class"; case TokenNamecontinue : - return "continue"/*nonNLS*/; + return "continue"; case TokenNamedefault : - return "default"/*nonNLS*/; + return "default"; case TokenNamedo : - return "do"/*nonNLS*/; + return "do"; case TokenNamedouble : - return "double"/*nonNLS*/; + return "double"; case TokenNameelse : - return "else"/*nonNLS*/; + return "else"; case TokenNameextends : - return "extends"/*nonNLS*/; + return "extends"; case TokenNamefalse : - return "false"/*nonNLS*/; + return "false"; case TokenNamefinal : - return "final"/*nonNLS*/; + return "final"; case TokenNamefinally : - return "finally"/*nonNLS*/; + return "finally"; case TokenNamefloat : - return "float"/*nonNLS*/; + return "float"; case TokenNamefor : - return "for"/*nonNLS*/; + return "for"; case TokenNameif : - return "if"/*nonNLS*/; + return "if"; case TokenNameimplements : - return "implements"/*nonNLS*/; + return "implements"; case TokenNameimport : - return "import"/*nonNLS*/; + return "import"; case TokenNameinstanceof : - return "instanceof"/*nonNLS*/; + return "instanceof"; case TokenNameint : - return "int"/*nonNLS*/; + return "int"; case TokenNameinterface : - return "interface"/*nonNLS*/; + return "interface"; case TokenNamelong : - return "long"/*nonNLS*/; + return "long"; case TokenNamenative : - return "native"/*nonNLS*/; + return "native"; case TokenNamenew : - return "new"/*nonNLS*/; + return "new"; case TokenNamenull : - return "null"/*nonNLS*/; + return "null"; case TokenNamepackage : - return "package"/*nonNLS*/; + return "package"; case TokenNameprivate : - return "private"/*nonNLS*/; + return "private"; case TokenNameprotected : - return "protected"/*nonNLS*/; + return "protected"; case TokenNamepublic : - return "public"/*nonNLS*/; + return "public"; case TokenNamereturn : - return "return"/*nonNLS*/; + return "return"; case TokenNameshort : - return "short"/*nonNLS*/; + return "short"; case TokenNamestatic : - return "static"/*nonNLS*/; + return "static"; case TokenNamesuper : - return "super"/*nonNLS*/; + return "super"; case TokenNameswitch : - return "switch"/*nonNLS*/; + return "switch"; case TokenNamesynchronized : - return "synchronized"/*nonNLS*/; + return "synchronized"; case TokenNamethis : - return "this"/*nonNLS*/; + return "this"; case TokenNamethrow : - return "throw"/*nonNLS*/; + return "throw"; case TokenNamethrows : - return "throws"/*nonNLS*/; + return "throws"; case TokenNametransient : - return "transient"/*nonNLS*/; + return "transient"; case TokenNametrue : - return "true"/*nonNLS*/; + return "true"; case TokenNametry : - return "try"/*nonNLS*/; + return "try"; case TokenNamevoid : - return "void"/*nonNLS*/; + return "void"; case TokenNamevolatile : - return "volatile"/*nonNLS*/; + return "volatile"; case TokenNamewhile : - return "while"/*nonNLS*/; + return "while"; case TokenNameIntegerLiteral : - return "Integer("/*nonNLS*/ + new String(getCurrentTokenSource()) + ")"/*nonNLS*/; + return "Integer(" + new String(getCurrentTokenSource()) + ")"; case TokenNameLongLiteral : - return "Long("/*nonNLS*/ + new String(getCurrentTokenSource()) + ")"/*nonNLS*/; + return "Long(" + new String(getCurrentTokenSource()) + ")"; case TokenNameFloatingPointLiteral : - return "Float("/*nonNLS*/ + new String(getCurrentTokenSource()) + ")"/*nonNLS*/; + return "Float(" + new String(getCurrentTokenSource()) + ")"; case TokenNameDoubleLiteral : - return "Double("/*nonNLS*/ + new String(getCurrentTokenSource()) + ")"/*nonNLS*/; + return "Double(" + new String(getCurrentTokenSource()) + ")"; case TokenNameCharacterLiteral : - return "Char("/*nonNLS*/ + new String(getCurrentTokenSource()) + ")"/*nonNLS*/; + return "Char(" + new String(getCurrentTokenSource()) + ")"; case TokenNameStringLiteral : - return "String("/*nonNLS*/ + new String(getCurrentTokenSource()) + ")"/*nonNLS*/; + return "String(" + new String(getCurrentTokenSource()) + ")"; case TokenNamePLUS_PLUS : - return "++"/*nonNLS*/; + return "++"; case TokenNameMINUS_MINUS : - return "--"/*nonNLS*/; + return "--"; case TokenNameEQUAL_EQUAL : - return "=="/*nonNLS*/; + return "=="; case TokenNameLESS_EQUAL : - return "<="/*nonNLS*/; + return "<="; case TokenNameGREATER_EQUAL : - return ">="/*nonNLS*/; + return ">="; case TokenNameNOT_EQUAL : - return "!="/*nonNLS*/; + return "!="; case TokenNameLEFT_SHIFT : - return "<<"/*nonNLS*/; + return "<<"; case TokenNameRIGHT_SHIFT : - return ">>"/*nonNLS*/; + return ">>"; case TokenNameUNSIGNED_RIGHT_SHIFT : - return ">>>"/*nonNLS*/; + return ">>>"; case TokenNamePLUS_EQUAL : - return "+="/*nonNLS*/; + return "+="; case TokenNameMINUS_EQUAL : - return "-="/*nonNLS*/; + return "-="; case TokenNameMULTIPLY_EQUAL : - return "*="/*nonNLS*/; + return "*="; case TokenNameDIVIDE_EQUAL : - return "/="/*nonNLS*/; + return "/="; case TokenNameAND_EQUAL : - return "&="/*nonNLS*/; + return "&="; case TokenNameOR_EQUAL : - return "|="/*nonNLS*/; + return "|="; case TokenNameXOR_EQUAL : - return "^="/*nonNLS*/; + return "^="; case TokenNameREMAINDER_EQUAL : - return "%="/*nonNLS*/; + return "%="; case TokenNameLEFT_SHIFT_EQUAL : - return "<<="/*nonNLS*/; + return "<<="; case TokenNameRIGHT_SHIFT_EQUAL : - return ">>="/*nonNLS*/; + return ">>="; case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : - return ">>>="/*nonNLS*/; + return ">>>="; case TokenNameOR_OR : - return "||"/*nonNLS*/; + return "||"; case TokenNameAND_AND : - return "&&"/*nonNLS*/; + return "&&"; case TokenNamePLUS : - return "+"/*nonNLS*/; + return "+"; case TokenNameMINUS : - return "-"/*nonNLS*/; + return "-"; case TokenNameNOT : - return "!"/*nonNLS*/; + return "!"; case TokenNameREMAINDER : - return "%"/*nonNLS*/; + return "%"; case TokenNameXOR : - return "^"/*nonNLS*/; + return "^"; case TokenNameAND : - return "&"/*nonNLS*/; + return "&"; case TokenNameMULTIPLY : - return "*"/*nonNLS*/; + return "*"; case TokenNameOR : - return "|"/*nonNLS*/; + return "|"; case TokenNameTWIDDLE : - return "~"/*nonNLS*/; + return "~"; case TokenNameDIVIDE : - return "/"/*nonNLS*/; + return "/"; case TokenNameGREATER : - return ">"/*nonNLS*/; + return ">"; case TokenNameLESS : - return "<"/*nonNLS*/; + return "<"; case TokenNameLPAREN : - return "("/*nonNLS*/; + return "("; case TokenNameRPAREN : - return ")"/*nonNLS*/; + return ")"; case TokenNameLBRACE : - return "{"/*nonNLS*/; + return "{"; case TokenNameRBRACE : - return "}"/*nonNLS*/; + return "}"; case TokenNameLBRACKET : - return "["/*nonNLS*/; + return "["; case TokenNameRBRACKET : - return "]"/*nonNLS*/; + return "]"; case TokenNameSEMICOLON : - return ";"/*nonNLS*/; + return ";"; case TokenNameQUESTION : - return "?"/*nonNLS*/; + return "?"; case TokenNameCOLON : - return ":"/*nonNLS*/; + return ":"; case TokenNameCOMMA : - return ","/*nonNLS*/; + return ","; case TokenNameDOT : - return "."/*nonNLS*/; + return "."; case TokenNameEQUAL : - return "="/*nonNLS*/; + return "="; case TokenNameEOF : - return "EOF"/*nonNLS*/; + return "EOF"; default : - return "not-a-token"/*nonNLS*/; + return "not-a-token"; } } - -public Scanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean checkNonExternalizedStringLiterals) { - this.eofPosition = Integer.MAX_VALUE; - this.tokenizeComments = tokenizeComments; - this.tokenizeWhiteSpace = tokenizeWhiteSpace; - this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals; -} }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalSymbols.java b/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalSymbols.java index f281179..1453932 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalSymbols.java +++ b/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalSymbols.java
@@ -1,12 +1,4 @@ package org.eclipse.jdt.internal.compiler.parser; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; - -/*Maps each terminal symbol in the java-grammar into a unique integer. -This integer is used to represent the terminal when computing a parsing action. */ public interface TerminalSymbols {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java b/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java index 96abfc5..09d6111 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java +++ b/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java
@@ -7,7 +7,6 @@ import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.*; import org.eclipse.jdt.internal.compiler.env.*; -import org.eclipse.jdt.internal.compiler.util.Util; public class DefaultProblem implements IProblem, ProblemSeverities, ProblemIrritants { private char[] fileName; @@ -45,7 +44,7 @@ //sanity ..... if ((startPosition > endPosition) || ((startPosition <= 0) && (endPosition <= 0))) - return Util.bind("problem.noSourceInformation"/*nonNLS*/); + return "\n!! no source information available !!"; //regular behavior....(slow code) @@ -111,8 +110,8 @@ //resize underneathto remove 'null' chars System.arraycopy(underneath, 0, underneath = new char[pos], 0, pos); - return Util.bind("problem.atLine"/*nonNLS*/,String.valueOf(line)) + - "\n\t"/*nonNLS*/ + new String(extract) + "\n\t"/*nonNLS*/ + new String(underneath); + return " (at line " + String.valueOf(line) + ")" + //NON NLS + "\n\t" + new String(extract) + "\n\t" + new String(underneath); } /** * Answer back the original arguments recorded into the problem. @@ -212,13 +211,13 @@ } public String toString() { - String s = "Pb("/*nonNLS*/ + (id & IgnoreCategoriesMask) + ") "/*nonNLS*/; + String s = "Pb(" + (id & IgnoreCategoriesMask) + ") "; if (message != null) { s += message; } else { if (arguments != null) for (int i = 0; i < arguments.length; i++) - s += " "/*nonNLS*/ + arguments[i]; + s += " " + arguments[i]; } return s; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java b/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java index b08aab3..37e4840 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java +++ b/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java
@@ -70,9 +70,9 @@ String message = messageTemplates[(id & ProblemIrritants.IgnoreCategoriesMask)]; if (message == null) { - return "Unable to retrieve the error message for problem id: "/*nonNLS*/ + return "Unable to retrieve the error message for problem id: " + id - + ". Check compiler resources."/*nonNLS*/; + + ". Check compiler resources."; } int length = message.length(); @@ -87,9 +87,9 @@ } catch (NumberFormatException nfe) { output.append(message.substring(end + 1, start + 1)); } catch (ArrayIndexOutOfBoundsException e) { - return "Corrupted compiler resources for problem id: "/*nonNLS*/ + return "Corrupted compiler resources for problem id: " + (id & ProblemIrritants.IgnoreCategoriesMask) - + ". Check compiler resources."/*nonNLS*/; + + ". Check compiler resources."; } } else { output.append(message.substring(end, length)); @@ -115,11 +115,11 @@ * to the current Locale. */ public static String[] loadMessageTemplates(Locale loc) { - ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.jdt.internal.compiler.problem.Messages"/*nonNLS*/, loc); + ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.jdt.internal.compiler.problem.Messages", loc); String[] templates = new String[500]; for (int i = 0, max = templates.length; i < max; i++) { try { - templates[i] = bundle.getString(String.valueOf(i)); + templates[i] = bundle.getString(String.valueOf(i)); //$NON-NLS-1$ } catch (MissingResourceException e) { } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemIrritants.java b/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemIrritants.java index e413005..2f898c5 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemIrritants.java +++ b/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemIrritants.java
@@ -1,11 +1,6 @@ package org.eclipse.jdt.internal.compiler.problem; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; -public interface ProblemIrritants { // max: 500 +public interface ProblemIrritants { // max: 500 // categories final int TypeRelated = 0x01000000; final int FieldRelated = 0x02000000; @@ -32,7 +27,7 @@ final int MissingEnclosingInstanceForConstructorCall = TypeRelated + 20; final int MissingEnclosingInstance = TypeRelated + 21; final int IncorrectEnclosingInstanceReference = TypeRelated + 22; - final int IllegalEnclosingInstanceSpecification = TypeRelated + 23; + final int IllegalEnclosingInstanceSpecification = TypeRelated + 23; final int CannotDefineStaticInitializerInLocalType = Internal + 24; final int OuterLocalMustBeFinal = Internal + 25; final int CannotDefineInterfaceInLocalType = Internal + 26; @@ -58,7 +53,7 @@ final int BytecodeExceeds64KLimitForClinit = Internal + 64; final int TooManyArgumentSlots = Internal + 65; final int TooManyLocalVariableSlots = Internal + 66; - + // fields final int UndefinedField = FieldRelated + 70; final int NotVisibleField = FieldRelated + 71; @@ -89,7 +84,7 @@ final int NoMessageSendOnBaseType = MethodRelated + 114; final int ParameterMismatch = MethodRelated + 115; final int NoMessageSendOnArrayType = MethodRelated + 116; - + // constructors final int UndefinedConstructor = ConstructorRelated + 130; final int NotVisibleConstructor = ConstructorRelated + 131; @@ -126,7 +121,7 @@ final int DuplicateDefaultCase = 166; final int UnreachableCatch = TypeRelated + MethodRelated + 167; final int UnhandledException = TypeRelated + 168; - // switch + // switch final int IncorrectSwitchType = TypeRelated + 169; final int DuplicateCase = FieldRelated + 170; // labelled @@ -167,7 +162,7 @@ final int UnmatchedBracket = Internal + 220; final int NoFieldOnBaseType = FieldRelated + 221; final int InvalidExpressionAsStatement = Internal + 222; - + // constants final int END_OF_SOURCE = Internal + 250; final int INVALID_HEXA = Internal + 251; @@ -189,7 +184,7 @@ final int IllegalModifierForMemberClass = TypeRelated + 304; final int IllegalModifierForMemberInterface = TypeRelated + 305; final int IllegalModifierForLocalClass = TypeRelated + 306; -// final int IllegalModifierForLocalInterface = TypeRelated + 307; +// final int IllegalModifierForLocalInterface = TypeRelated + 307; final int IllegalModifierCombinationFinalAbstractForClass = TypeRelated + 308; final int IllegalVisibilityModifierForInterfaceMemberType = TypeRelated + 309; final int IllegalVisibilityModifierCombinationForMemberType = TypeRelated + 310; @@ -272,8 +267,4 @@ // code snippet support final int CodeSnippetMissingClass = Internal + 420; final int CodeSnippetMissingMethod = Internal + 421; - final int NonExternalizedStringLiteral = Internal + 261; - - //constant pool - final int TooManyConstantsInConstantPool = Internal + 430; }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java index df2222c..d103747 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java +++ b/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -167,7 +167,7 @@ this.handle( FinalFieldAssignment, new String[] { - (field.declaringClass == null ? "array"/*nonNLS*/ : new String(field.declaringClass.readableName())), + (field.declaringClass == null ? "array" : new String(field.declaringClass.readableName())), new String(field.readableName())}, location.sourceStart(), location.sourceEnd()); @@ -420,15 +420,7 @@ return Warning; } return Ignore; - case NonExternalizedStringLiteral : - if ((errorThreshold & NonExternalizedString) != 0){ - return Error; - } - if ((warningThreshold & NonExternalizedString) != 0){ - return Warning; - } - return Ignore; - + default: return Error; } @@ -459,10 +451,10 @@ final int radix; if ((source[1] == 'x') || (source[1] == 'X')) { radix = 16; - Radix = "Hexa"/*nonNLS*/; + Radix = "Hexa"; } else { radix = 8; - Radix = "Octal"/*nonNLS*/; + Radix = "Octal"; } //look for the first digit that is incorrect int place = -1; @@ -475,7 +467,7 @@ this.handle( NumericValueOutOfRange, - new String[] {Radix + " "/*nonNLS*/ + new String(source) + " (digit "/*nonNLS*/ + new String(new char[] {source[place]}) + ")"/*nonNLS*/}, + new String[] {Radix + " " + new String(source) + " (digit " + new String(new char[] {source[place]}) + ")"}, lit.sourceStart, lit.sourceEnd); return; @@ -640,7 +632,7 @@ StringBuffer buffer = new StringBuffer(); for (int i = 0, length = params.length; i < length; i++) { if (i != 0) - buffer.append(", "/*nonNLS*/); + buffer.append(", "); buffer.append(new String(params[i].readableName())); } @@ -653,7 +645,7 @@ public void errorThisSuperInStatic(AstNode reference) { this.handle( ThisInStaticContext, - new String[] {reference.isSuper() ? "super"/*nonNLS*/ : "this"/*nonNLS*/}, + new String[] {reference.isSuper() ? "super" : "this"}, reference.sourceStart, reference.sourceEnd); } @@ -789,7 +781,7 @@ public void hierarchyCircularity(SourceTypeBinding sourceType, ReferenceBinding superType, TypeReference reference) { int start = 0; int end = 0; - String typeName = ""/*nonNLS*/; + String typeName = ""; if (reference == null) { // can only happen when java.lang.Object is busted start = sourceType.sourceStart(); @@ -1073,7 +1065,7 @@ .append('.') .append(inheritedMethods[i].readableName()); if (i != 0) - methodSignatures.append(", "/*nonNLS*/); + methodSignatures.append(", "); } this.handle( @@ -1188,7 +1180,7 @@ this.handle( flag, - new String[] {new String(enclosingType.readableName()) + "."/*nonNLS*/ + new String(type.readableName())}, + new String[] {new String(enclosingType.readableName()) + "." + new String(type.readableName())}, expression.sourceStart, expression.sourceEnd); } @@ -1399,7 +1391,7 @@ InvalidOperator, new String[] { expression.operatorToString(), - new String(leftType.readableName()) + ", "/*nonNLS*/ + new String(rightType.readableName())}, + new String(leftType.readableName()) + ", " + new String(rightType.readableName())}, expression.sourceStart, expression.sourceEnd); } @@ -1408,7 +1400,7 @@ InvalidOperator, new String[] { assign.operatorToString(), - new String(leftType.readableName()) + ", "/*nonNLS*/ + new String(rightType.readableName())}, + new String(leftType.readableName()) + ", " + new String(rightType.readableName())}, assign.sourceStart, assign.sourceEnd); } @@ -1604,7 +1596,7 @@ methodDecl.sourceEnd()); } public void needImplementation() { - this.abortDueToInternalError(Util.bind("abort.missingCode"/*nonNLS*/)); + this.abortDueToInternalError("Missing code implementation in the compiler"); } public void needToEmulateFieldReadAccess(FieldBinding field, AstNode location) { this.handle( @@ -1720,7 +1712,7 @@ StringBuffer buffer = new StringBuffer(); for (int i = 0, length = params.length; i < length; i++) { if (i != 0) - buffer.append(", "/*nonNLS*/); + buffer.append(", "); buffer.append(new String(params[i].readableName())); } return buffer.toString(); @@ -1750,20 +1742,20 @@ StringBuffer list = new StringBuffer(20); for (int i = 0, max = possibleTokens.length; i < max; i++) { if (i > 0) - list.append(", "/*nonNLS*/); + list.append(", "); list.append('"'); list.append(possibleTokens[i]); list.append('"'); } - //extract the literal when it's a literal - if ((errorTokenName.equals("IntegerLiteral"/*nonNLS*/)) || - (errorTokenName.equals("LongLiteral"/*nonNLS*/)) || - (errorTokenName.equals("FloatingPointLiteral"/*nonNLS*/)) || - (errorTokenName.equals("DoubleLiteral"/*nonNLS*/)) || - (errorTokenName.equals("StringLiteral"/*nonNLS*/)) || - (errorTokenName.equals("CharacterLiteral"/*nonNLS*/)) || - (errorTokenName.equals("Identifier"/*nonNLS*/))) { + //extract the literal when it's a literal (fancier error message ...) + if ((errorTokenName.equals("IntegerLiteral")) || + (errorTokenName.equals("LongLiteral")) || + (errorTokenName.equals("FloatingPointLiteral")) || + (errorTokenName.equals("DoubleLiteral")) || + (errorTokenName.equals("StringLiteral")) || + (errorTokenName.equals("CharacterLiteral")) || + (errorTokenName.equals("Identifier"))) { errorTokenName = new String(currentTokenSource); } @@ -1901,9 +1893,8 @@ if (errorTokenName.equals(Scanner.INVALID_UNICODE_ESCAPE)){ flag = INVALID_UNICODE_ESCAPE; // better locate the error message - char[] source = scanner.source; int checkPos = scanner.currentPosition - 1; - if (checkPos >= source.length) checkPos = source.length - 1; + char[] source = scanner.source; while (checkPos >= startPos){ if (source[checkPos] == '\\') break; checkPos --; @@ -2195,21 +2186,4 @@ typeRef.sourceStart, typeRef.sourceEnd); } - -public void nonExternalizedStringLiteral(AstNode location) { - this.handle( - NonExternalizedStringLiteral, - new String[] {}, - location.sourceStart, - location.sourceEnd); -} - -public void noMoreAvailableSpaceInConstantPool(TypeDeclaration typeDeclaration) { - this.handle( - TooManyConstantsInConstantPool, - new String[]{ new String(typeDeclaration.binding.readableName())}, - Abort | Error, - typeDeclaration.sourceStart(), - typeDeclaration.sourceEnd()); -} }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemSeverities.java b/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemSeverities.java index a726d13..24edf61 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemSeverities.java +++ b/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemSeverities.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.problem; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public interface ProblemSeverities { final int Ignore = -1; // during handling only
diff --git a/compiler/org/eclipse/jdt/internal/compiler/problem/ShouldNotImplement.java b/compiler/org/eclipse/jdt/internal/compiler/problem/ShouldNotImplement.java index 1808c78..3f2b6d8 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/problem/ShouldNotImplement.java +++ b/compiler/org/eclipse/jdt/internal/compiler/problem/ShouldNotImplement.java
@@ -1,16 +1,5 @@ package org.eclipse.jdt.internal.compiler.problem; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; -/* - * Special unchecked exception type used - * to denote implementation that should never be reached. - * - * (internal only) - */ public class ShouldNotImplement extends RuntimeException { public ShouldNotImplement(){ }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/util/CharOperation.java b/compiler/org/eclipse/jdt/internal/compiler/util/CharOperation.java index a66de9c..e95120a 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/util/CharOperation.java +++ b/compiler/org/eclipse/jdt/internal/compiler/util/CharOperation.java
@@ -542,7 +542,7 @@ final static public String toString(char[][] array) { char[] result = concatWith(array, '.'); if (result == null) - return ""/*nonNLS*/; + return ""; return new String(result); } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInt.java b/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInt.java index e1b870d..fd0deae 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInt.java +++ b/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInt.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.compiler.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; - - /** - * Hashtable for non-zero int keys. - */ - + public final class HashtableOfInt { // to avoid using Enumerations, walk the individual tables skipping nulls public int[] keyTable; @@ -42,7 +33,7 @@ int index = key % valueTable.length; int currentKey; while ((currentKey = keyTable[index]) != 0) { - if (currentKey == key) return valueTable[index]; + if (currentKey == key) return valueTable[index]; index = (index + 1) % keyTable.length; } return null; @@ -51,7 +42,7 @@ int index = key % valueTable.length; int currentKey; while ((currentKey = keyTable[index]) != 0) { - if (currentKey == key) return valueTable[index] = value; + if (currentKey == key) return valueTable[index] = value; index = (index + 1) % keyTable.length; } keyTable[index] = key; @@ -77,11 +68,11 @@ return elementSize; } public String toString() { - String s = ""/*nonNLS*/; + String s = ""; Object object; for (int i = 0, length = valueTable.length; i < length; i++) if ((object = valueTable[i]) != null) - s += keyTable[i] + " -> "/*nonNLS*/ + object.toString() + "\n"/*nonNLS*/; + s += keyTable[i] + " -> " + object.toString() + "\n"; return s; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java b/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java index 8143a93..ddd3b9d 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java +++ b/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.compiler.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public final class HashtableOfObject { // to avoid using Enumerations, walk the individual tables skipping nulls @@ -78,11 +73,11 @@ return elementSize; } public String toString() { - String s = ""/*nonNLS*/; + String s = ""; Object object; for (int i = 0, length = valueTable.length; i < length; i++) if ((object = valueTable[i]) != null) - s += new String(keyTable[i]) + " -> "/*nonNLS*/ + object.toString() + "\n"/*nonNLS*/; + s += new String(keyTable[i]) + " -> " + object.toString() + "\n"; return s; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfPackage.java b/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfPackage.java index 2e4308f..62eae6a 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfPackage.java +++ b/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfPackage.java
@@ -79,11 +79,11 @@ return elementSize; } public String toString() { - String s = ""/*nonNLS*/; + String s = ""; PackageBinding pkg; for (int i = 0, length = valueTable.length; i < length; i++) if ((pkg = valueTable[i]) != null) - s += pkg.toString() + "\n"/*nonNLS*/; + s += pkg.toString() + "\n"; return s; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java b/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java index 487b841..a265274 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java +++ b/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java
@@ -79,11 +79,11 @@ return elementSize; } public String toString() { - String s = ""/*nonNLS*/; + String s = ""; ReferenceBinding type; for (int i = 0, length = valueTable.length; i < length; i++) if ((type = valueTable[i]) != null) - s += type.toString() + "\n"/*nonNLS*/; + s += type.toString() + "\n"; return s; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/util/ObjectVector.java b/compiler/org/eclipse/jdt/internal/compiler/util/ObjectVector.java index c47e0ab..cb6f61d 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/util/ObjectVector.java +++ b/compiler/org/eclipse/jdt/internal/compiler/util/ObjectVector.java
@@ -1,13 +1,8 @@ package org.eclipse.jdt.internal.compiler.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public final class ObjectVector { static int INITIAL_SIZE = 10; - + public int size; int maxSize; Object[] elements; @@ -17,13 +12,13 @@ elements = new Object[maxSize]; } public void add(Object newElement) { - if (size == maxSize) // knows that size starts <= maxSize + if (size == maxSize) // knows that size starts <= maxSize System.arraycopy(elements, 0, (elements = new Object[maxSize *= 2]), 0, size); elements[size++] = newElement; } public void addAll(Object[] newElements) { if (size + newElements.length >= maxSize) { - maxSize = size + newElements.length; // assume no more elements will be added + maxSize = size + newElements.length; // assume no more elements will be added System.arraycopy(elements, 0, (elements = new Object[maxSize]), 0, size); } System.arraycopy(newElements, 0, elements, size, newElements.length); @@ -61,9 +56,9 @@ size = 0; } public String toString() { - String s = ""/*nonNLS*/; + String s = ""; for (int i = 0; i < size; i++) - s += elements[i].toString() + "\n"/*nonNLS*/; + s += elements[i].toString() + "\n"; return s; } }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/util/SimpleNameVector.java b/compiler/org/eclipse/jdt/internal/compiler/util/SimpleNameVector.java index 1cb38e3..c786cf2 100644 --- a/compiler/org/eclipse/jdt/internal/compiler/util/SimpleNameVector.java +++ b/compiler/org/eclipse/jdt/internal/compiler/util/SimpleNameVector.java
@@ -1,13 +1,8 @@ package org.eclipse.jdt.internal.compiler.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.compiler.*; public final class SimpleNameVector { static int INITIAL_SIZE = 10; - + public int size; int maxSize; char[][] elements; @@ -17,13 +12,13 @@ elements = new char[maxSize][]; } public void add(char[] newElement) { - if (size == maxSize) // knows that size starts <= maxSize + if (size == maxSize) // knows that size starts <= maxSize System.arraycopy(elements, 0, (elements = new char[maxSize *= 2][]), 0, size); elements[size++] = newElement; } public void addAll(char[][] newElements) { if (size + newElements.length >= maxSize) { - maxSize = size + newElements.length; // assume no more elements will be added + maxSize = size + newElements.length; // assume no more elements will be added System.arraycopy(elements, 0, (elements = new char[maxSize][]), 0, size); } System.arraycopy(newElements, 0, elements, size, newElements.length); @@ -57,7 +52,7 @@ public String toString() { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < size; i++) { - buffer.append(elements[i]).append("\n"/*nonNLS*/); + buffer.append(elements[i]).append("\n"); } return buffer.toString(); }
diff --git a/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java b/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java index 2e53f8d..f4abf98 100644 --- a/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java +++ b/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java
@@ -106,14 +106,14 @@ if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null) argHasError = true; if (argHasError) - return typeBinding; + return null; } if (typeBinding == null) return null; if (!typeBinding.canBeInstantiated()) { scope.problemReporter().cannotInstantiate(type, typeBinding); - return typeBinding; + return null; } ReferenceBinding allocatedType = (ReferenceBinding) typeBinding; if (!(binding = scope.getConstructor(allocatedType, argumentTypes, this)).isValidBinding()) { @@ -125,13 +125,13 @@ if (binding.declaringClass == null) binding.declaringClass = allocatedType; scope.problemReporter().invalidConstructor(this, binding); - return typeBinding; + return null; } } else { if (binding.declaringClass == null) binding.declaringClass = allocatedType; scope.problemReporter().invalidConstructor(this, binding); - return typeBinding; + return null; } CodeSnippetScope localScope = new CodeSnippetScope(scope); MethodBinding privateBinding = localScope.getConstructor((ReferenceBinding)delegateThis.type, argumentTypes, this); @@ -139,7 +139,7 @@ if (binding.declaringClass == null) binding.declaringClass = allocatedType; scope.problemReporter().invalidConstructor(this, binding); - return typeBinding; + return null; } else { binding = privateBinding; } @@ -147,7 +147,7 @@ if (binding.declaringClass == null) binding.declaringClass = allocatedType; scope.problemReporter().invalidConstructor(this, binding); - return typeBinding; + return null; } } if (isMethodUseDeprecated(binding, scope))
diff --git a/eval/org/eclipse/jdt/internal/eval/CodeSnippetConstantPool.java b/eval/org/eclipse/jdt/internal/eval/CodeSnippetConstantPool.java index 0d3d923..0ceed81 100644 --- a/eval/org/eclipse/jdt/internal/eval/CodeSnippetConstantPool.java +++ b/eval/org/eclipse/jdt/internal/eval/CodeSnippetConstantPool.java
@@ -15,82 +15,82 @@ public class CodeSnippetConstantPool extends ConstantPool implements TypeConstants { // predefined type constant names - final static char[][] JAVA_LANG_REFLECT_FIELD = new char[][] {JAVA, LANG, REFLECT, "Field"/*nonNLS*/.toCharArray()}; - final static char[][] JAVA_LANG_REFLECT_ACCESSIBLEOBJECT = new char[][] {JAVA, LANG, REFLECT, "AccessibleObject"/*nonNLS*/.toCharArray()}; - final static char[][] JAVA_LANG_REFLECT_METHOD = new char[][] {JAVA, LANG, REFLECT, "Method"/*nonNLS*/.toCharArray()}; - final static char[][] JAVA_LANG_REFLECT_ARRAY = new char[][] {JAVA, LANG, REFLECT, "Array"/*nonNLS*/.toCharArray()}; + final static char[][] JAVA_LANG_REFLECT_FIELD = new char[][] {JAVA, LANG, REFLECT, "Field".toCharArray()}; + final static char[][] JAVA_LANG_REFLECT_ACCESSIBLEOBJECT = new char[][] {JAVA, LANG, REFLECT, "AccessibleObject".toCharArray()}; + final static char[][] JAVA_LANG_REFLECT_METHOD = new char[][] {JAVA, LANG, REFLECT, "Method".toCharArray()}; + final static char[][] JAVA_LANG_REFLECT_ARRAY = new char[][] {JAVA, LANG, REFLECT, "Array".toCharArray()}; // predefined methods constant names - final static char[] GETDECLAREDFIELD_NAME = "getDeclaredField"/*nonNLS*/.toCharArray(); - final static char[] GETDECLAREDFIELD_SIGNATURE = "(Ljava/lang/String;)Ljava/lang/reflect/Field;"/*nonNLS*/.toCharArray(); - final static char[] SETACCESSIBLE_NAME = "setAccessible"/*nonNLS*/.toCharArray(); - final static char[] SETACCESSIBLE_SIGNATURE = "(Z)V"/*nonNLS*/.toCharArray(); - final static char[] JAVALANGREFLECTFIELD_CONSTANTPOOLNAME = "java/lang/reflect/Field"/*nonNLS*/.toCharArray(); - final static char[] JAVALANGREFLECTACCESSIBLEOBJECT_CONSTANTPOOLNAME = "java/lang/reflect/AccessibleObject"/*nonNLS*/.toCharArray(); - final static char[] JAVALANGREFLECTARRAY_CONSTANTPOOLNAME = "java/lang/reflect/Array"/*nonNLS*/.toCharArray(); - final static char[] JAVALANGREFLECTMETHOD_CONSTANTPOOLNAME = "java/lang/reflect/Method"/*nonNLS*/.toCharArray(); - final static char[] GET_INT_METHOD_NAME = "getInt"/*nonNLS*/.toCharArray(); - final static char[] GET_LONG_METHOD_NAME = "getLong"/*nonNLS*/.toCharArray(); - final static char[] GET_DOUBLE_METHOD_NAME = "getDouble"/*nonNLS*/.toCharArray(); - final static char[] GET_FLOAT_METHOD_NAME = "getFloat"/*nonNLS*/.toCharArray(); - final static char[] GET_BYTE_METHOD_NAME = "getByte"/*nonNLS*/.toCharArray(); - final static char[] GET_CHAR_METHOD_NAME = "getChar"/*nonNLS*/.toCharArray(); - final static char[] GET_BOOLEAN_METHOD_NAME = "getBoolean"/*nonNLS*/.toCharArray(); - final static char[] GET_OBJECT_METHOD_NAME = "get"/*nonNLS*/.toCharArray(); - final static char[] GET_SHORT_METHOD_NAME = "getShort"/*nonNLS*/.toCharArray(); - final static char[] ARRAY_NEWINSTANCE_NAME = "newInstance"/*nonNLS*/.toCharArray(); - final static char[] GET_INT_METHOD_SIGNATURE = "(Ljava/lang/Object;)I"/*nonNLS*/.toCharArray(); - final static char[] GET_LONG_METHOD_SIGNATURE = "(Ljava/lang/Object;)J"/*nonNLS*/.toCharArray(); - final static char[] GET_DOUBLE_METHOD_SIGNATURE = "(Ljava/lang/Object;)D"/*nonNLS*/.toCharArray(); - final static char[] GET_FLOAT_METHOD_SIGNATURE = "(Ljava/lang/Object;)F"/*nonNLS*/.toCharArray(); - final static char[] GET_BYTE_METHOD_SIGNATURE = "(Ljava/lang/Object;)B"/*nonNLS*/.toCharArray(); - final static char[] GET_CHAR_METHOD_SIGNATURE = "(Ljava/lang/Object;)C"/*nonNLS*/.toCharArray(); - final static char[] GET_BOOLEAN_METHOD_SIGNATURE = "(Ljava/lang/Object;)Z"/*nonNLS*/.toCharArray(); - final static char[] GET_OBJECT_METHOD_SIGNATURE = "(Ljava/lang/Object;)Ljava/lang/Object;"/*nonNLS*/.toCharArray(); - final static char[] GET_SHORT_METHOD_SIGNATURE = "(Ljava/lang/Object;)S"/*nonNLS*/.toCharArray(); - final static char[] SET_INT_METHOD_NAME = "setInt"/*nonNLS*/.toCharArray(); - final static char[] SET_LONG_METHOD_NAME = "setLong"/*nonNLS*/.toCharArray(); - final static char[] SET_DOUBLE_METHOD_NAME = "setDouble"/*nonNLS*/.toCharArray(); - final static char[] SET_FLOAT_METHOD_NAME = "setFloat"/*nonNLS*/.toCharArray(); - final static char[] SET_BYTE_METHOD_NAME = "setByte"/*nonNLS*/.toCharArray(); - final static char[] SET_CHAR_METHOD_NAME = "setChar"/*nonNLS*/.toCharArray(); - final static char[] SET_BOOLEAN_METHOD_NAME = "setBoolean"/*nonNLS*/.toCharArray(); - final static char[] SET_OBJECT_METHOD_NAME = "set"/*nonNLS*/.toCharArray(); - final static char[] SET_SHORT_METHOD_NAME = "setShort"/*nonNLS*/.toCharArray(); - final static char[] GETCLASS_OBJECT_METHOD_NAME = "getClass"/*nonNLS*/.toCharArray(); - final static char[] SET_INT_METHOD_SIGNATURE = "(Ljava/lang/Object;I)V"/*nonNLS*/.toCharArray(); - final static char[] SET_LONG_METHOD_SIGNATURE = "(Ljava/lang/Object;J)V"/*nonNLS*/.toCharArray(); - final static char[] SET_DOUBLE_METHOD_SIGNATURE = "(Ljava/lang/Object;D)V"/*nonNLS*/.toCharArray(); - final static char[] SET_FLOAT_METHOD_SIGNATURE = "(Ljava/lang/Object;F)V"/*nonNLS*/.toCharArray(); - final static char[] SET_BYTE_METHOD_SIGNATURE = "(Ljava/lang/Object;B)V"/*nonNLS*/.toCharArray(); - final static char[] SET_CHAR_METHOD_SIGNATURE = "(Ljava/lang/Object;C)V"/*nonNLS*/.toCharArray(); - final static char[] SET_BOOLEAN_METHOD_SIGNATURE = "(Ljava/lang/Object;Z)V"/*nonNLS*/.toCharArray(); - final static char[] SET_OBJECT_METHOD_SIGNATURE = "(Ljava/lang/Object;Ljava/lang/Object;)V"/*nonNLS*/.toCharArray(); - final static char[] SET_SHORT_METHOD_SIGNATURE = "(Ljava/lang/Object;S)V"/*nonNLS*/.toCharArray(); - final static char[] GETDECLAREDMETHOD_NAME = "getDeclaredMethod"/*nonNLS*/.toCharArray(); - final static char[] GETDECLAREDMETHOD_SIGNATURE = "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;"/*nonNLS*/.toCharArray(); - final static char[] ARRAY_NEWINSTANCE_SIGNATURE = "(Ljava/lang/Class;[I)Ljava/lang/Object;"/*nonNLS*/.toCharArray(); - final static char[] GETCLASS_OBJECT_METHOD_SIGNATURE = "()Ljava/lang/Class;"/*nonNLS*/.toCharArray(); - final static char[] INVOKE_METHOD_METHOD_NAME = "invoke"/*nonNLS*/.toCharArray(); - final static char[] INVOKE_METHOD_METHOD_SIGNATURE = "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;"/*nonNLS*/.toCharArray(); - final static char[] BYTEVALUE_BYTE_METHOD_NAME = "byteValue"/*nonNLS*/.toCharArray(); - final static char[] BYTEVALUE_BYTE_METHOD_SIGNATURE = "()B"/*nonNLS*/.toCharArray(); - final static char[] SHORTVALUE_SHORT_METHOD_NAME = "shortValue"/*nonNLS*/.toCharArray(); - final static char[] DOUBLEVALUE_DOUBLE_METHOD_NAME = "doubleValue"/*nonNLS*/.toCharArray(); - final static char[] FLOATVALUE_FLOAT_METHOD_NAME = "floatValue"/*nonNLS*/.toCharArray(); - final static char[] INTVALUE_INTEGER_METHOD_NAME = "intValue"/*nonNLS*/.toCharArray(); - final static char[] CHARVALUE_CHARACTER_METHOD_NAME = "charValue"/*nonNLS*/.toCharArray(); - final static char[] BOOLEANVALUE_BOOLEAN_METHOD_NAME = "booleanValue"/*nonNLS*/.toCharArray(); - final static char[] LONGVALUE_LONG_METHOD_NAME = "longValue"/*nonNLS*/.toCharArray(); - final static char[] SHORTVALUE_SHORT_METHOD_SIGNATURE = "()S"/*nonNLS*/.toCharArray(); - final static char[] DOUBLEVALUE_DOUBLE_METHOD_SIGNATURE = "()D"/*nonNLS*/.toCharArray(); - final static char[] FLOATVALUE_FLOAT_METHOD_SIGNATURE = "()F"/*nonNLS*/.toCharArray(); - final static char[] INTVALUE_INTEGER_METHOD_SIGNATURE = "()I"/*nonNLS*/.toCharArray(); - final static char[] CHARVALUE_CHARACTER_METHOD_SIGNATURE = "()C"/*nonNLS*/.toCharArray(); - final static char[] BOOLEANVALUE_BOOLEAN_METHOD_SIGNATURE = "()Z"/*nonNLS*/.toCharArray(); - final static char[] LONGVALUE_LONG_METHOD_SIGNATURE = "()J"/*nonNLS*/.toCharArray(); - final static char[] GETDECLAREDCONSTRUCTOR_NAME = "getDeclaredConstructor"/*nonNLS*/.toCharArray(); - final static char[] GETDECLAREDCONSTRUCTOR_SIGNATURE = "([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;"/*nonNLS*/.toCharArray(); + final static char[] GETDECLAREDFIELD_NAME = "getDeclaredField".toCharArray(); + final static char[] GETDECLAREDFIELD_SIGNATURE = "(Ljava/lang/String;)Ljava/lang/reflect/Field;".toCharArray(); + final static char[] SETACCESSIBLE_NAME = "setAccessible".toCharArray(); + final static char[] SETACCESSIBLE_SIGNATURE = "(Z)V".toCharArray(); + final static char[] JAVALANGREFLECTFIELD_CONSTANTPOOLNAME = "java/lang/reflect/Field".toCharArray(); + final static char[] JAVALANGREFLECTACCESSIBLEOBJECT_CONSTANTPOOLNAME = "java/lang/reflect/AccessibleObject".toCharArray(); + final static char[] JAVALANGREFLECTARRAY_CONSTANTPOOLNAME = "java/lang/reflect/Array".toCharArray(); + final static char[] JAVALANGREFLECTMETHOD_CONSTANTPOOLNAME = "java/lang/reflect/Method".toCharArray(); + final static char[] GET_INT_METHOD_NAME = "getInt".toCharArray(); + final static char[] GET_LONG_METHOD_NAME = "getLong".toCharArray(); + final static char[] GET_DOUBLE_METHOD_NAME = "getDouble".toCharArray(); + final static char[] GET_FLOAT_METHOD_NAME = "getFloat".toCharArray(); + final static char[] GET_BYTE_METHOD_NAME = "getByte".toCharArray(); + final static char[] GET_CHAR_METHOD_NAME = "getChar".toCharArray(); + final static char[] GET_BOOLEAN_METHOD_NAME = "getBoolean".toCharArray(); + final static char[] GET_OBJECT_METHOD_NAME = "get".toCharArray(); + final static char[] GET_SHORT_METHOD_NAME = "getShort".toCharArray(); + final static char[] ARRAY_NEWINSTANCE_NAME = "newInstance".toCharArray(); + final static char[] GET_INT_METHOD_SIGNATURE = "(Ljava/lang/Object;)I".toCharArray(); + final static char[] GET_LONG_METHOD_SIGNATURE = "(Ljava/lang/Object;)J".toCharArray(); + final static char[] GET_DOUBLE_METHOD_SIGNATURE = "(Ljava/lang/Object;)D".toCharArray(); + final static char[] GET_FLOAT_METHOD_SIGNATURE = "(Ljava/lang/Object;)F".toCharArray(); + final static char[] GET_BYTE_METHOD_SIGNATURE = "(Ljava/lang/Object;)B".toCharArray(); + final static char[] GET_CHAR_METHOD_SIGNATURE = "(Ljava/lang/Object;)C".toCharArray(); + final static char[] GET_BOOLEAN_METHOD_SIGNATURE = "(Ljava/lang/Object;)Z".toCharArray(); + final static char[] GET_OBJECT_METHOD_SIGNATURE = "(Ljava/lang/Object;)Ljava/lang/Object;".toCharArray(); + final static char[] GET_SHORT_METHOD_SIGNATURE = "(Ljava/lang/Object;)S".toCharArray(); + final static char[] SET_INT_METHOD_NAME = "setInt".toCharArray(); + final static char[] SET_LONG_METHOD_NAME = "setLong".toCharArray(); + final static char[] SET_DOUBLE_METHOD_NAME = "setDouble".toCharArray(); + final static char[] SET_FLOAT_METHOD_NAME = "setFloat".toCharArray(); + final static char[] SET_BYTE_METHOD_NAME = "setByte".toCharArray(); + final static char[] SET_CHAR_METHOD_NAME = "setChar".toCharArray(); + final static char[] SET_BOOLEAN_METHOD_NAME = "setBoolean".toCharArray(); + final static char[] SET_OBJECT_METHOD_NAME = "set".toCharArray(); + final static char[] SET_SHORT_METHOD_NAME = "setShort".toCharArray(); + final static char[] GETCLASS_OBJECT_METHOD_NAME = "getClass".toCharArray(); + final static char[] SET_INT_METHOD_SIGNATURE = "(Ljava/lang/Object;I)V".toCharArray(); + final static char[] SET_LONG_METHOD_SIGNATURE = "(Ljava/lang/Object;J)V".toCharArray(); + final static char[] SET_DOUBLE_METHOD_SIGNATURE = "(Ljava/lang/Object;D)V".toCharArray(); + final static char[] SET_FLOAT_METHOD_SIGNATURE = "(Ljava/lang/Object;F)V".toCharArray(); + final static char[] SET_BYTE_METHOD_SIGNATURE = "(Ljava/lang/Object;B)V".toCharArray(); + final static char[] SET_CHAR_METHOD_SIGNATURE = "(Ljava/lang/Object;C)V".toCharArray(); + final static char[] SET_BOOLEAN_METHOD_SIGNATURE = "(Ljava/lang/Object;Z)V".toCharArray(); + final static char[] SET_OBJECT_METHOD_SIGNATURE = "(Ljava/lang/Object;Ljava/lang/Object;)V".toCharArray(); + final static char[] SET_SHORT_METHOD_SIGNATURE = "(Ljava/lang/Object;S)V".toCharArray(); + final static char[] GETDECLAREDMETHOD_NAME = "getDeclaredMethod".toCharArray(); + final static char[] GETDECLAREDMETHOD_SIGNATURE = "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;".toCharArray(); + final static char[] ARRAY_NEWINSTANCE_SIGNATURE = "(Ljava/lang/Class;[I)Ljava/lang/Object;".toCharArray(); + final static char[] GETCLASS_OBJECT_METHOD_SIGNATURE = "()Ljava/lang/Class;".toCharArray(); + final static char[] INVOKE_METHOD_METHOD_NAME = "invoke".toCharArray(); + final static char[] INVOKE_METHOD_METHOD_SIGNATURE = "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;".toCharArray(); + final static char[] BYTEVALUE_BYTE_METHOD_NAME = "byteValue".toCharArray(); + final static char[] BYTEVALUE_BYTE_METHOD_SIGNATURE = "()B".toCharArray(); + final static char[] SHORTVALUE_SHORT_METHOD_NAME = "shortValue".toCharArray(); + final static char[] DOUBLEVALUE_DOUBLE_METHOD_NAME = "doubleValue".toCharArray(); + final static char[] FLOATVALUE_FLOAT_METHOD_NAME = "floatValue".toCharArray(); + final static char[] INTVALUE_INTEGER_METHOD_NAME = "intValue".toCharArray(); + final static char[] CHARVALUE_CHARACTER_METHOD_NAME = "charValue".toCharArray(); + final static char[] BOOLEANVALUE_BOOLEAN_METHOD_NAME = "booleanValue".toCharArray(); + final static char[] LONGVALUE_LONG_METHOD_NAME = "longValue".toCharArray(); + final static char[] SHORTVALUE_SHORT_METHOD_SIGNATURE = "()S".toCharArray(); + final static char[] DOUBLEVALUE_DOUBLE_METHOD_SIGNATURE = "()D".toCharArray(); + final static char[] FLOATVALUE_FLOAT_METHOD_SIGNATURE = "()F".toCharArray(); + final static char[] INTVALUE_INTEGER_METHOD_SIGNATURE = "()I".toCharArray(); + final static char[] CHARVALUE_CHARACTER_METHOD_SIGNATURE = "()C".toCharArray(); + final static char[] BOOLEANVALUE_BOOLEAN_METHOD_SIGNATURE = "()Z".toCharArray(); + final static char[] LONGVALUE_LONG_METHOD_SIGNATURE = "()J".toCharArray(); + final static char[] GETDECLAREDCONSTRUCTOR_NAME = "getDeclaredConstructor".toCharArray(); + final static char[] GETDECLAREDCONSTRUCTOR_SIGNATURE = "([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;".toCharArray(); // predefined constant index for well known types final static int JAVA_LANG_REFLECT_FIELD_TYPE = 0;
diff --git a/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java b/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java index f9f24ff..94ae420 100644 --- a/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java +++ b/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java
@@ -501,24 +501,17 @@ return super.reportError(scope); } - if ((binding instanceof ProblemFieldBinding && ((ProblemFieldBinding) binding).problemId() == NotFound) - || (binding instanceof ProblemBinding && ((ProblemBinding) binding).problemId() == NotFound)){ + if (binding instanceof ProblemFieldBinding && ((ProblemFieldBinding) binding).problemId() == NotFound){ + // will not support innerclass emulation inside delegate + binding = scope.getField(delegateThis.type, this.tokens[0], this); + if (!binding.isValidBinding()) return super.reportError(scope); + return checkFieldAccess(scope); + } + + if (binding instanceof ProblemBinding && ((ProblemBinding) binding).problemId() == NotFound){ // will not support innerclass emulation inside delegate FieldBinding fieldBinding = scope.getField(delegateThis.type, this.tokens[0], this); - if (!fieldBinding.isValidBinding()) { - if (((ProblemFieldBinding) fieldBinding).problemId() == NotVisible) { - // manage the access to a private field of the enclosing type - CodeSnippetScope localScope = new CodeSnippetScope(scope); - binding = localScope.getFieldForCodeSnippet(delegateThis.type, this.tokens[0], this); - if (binding.isValidBinding()) { - return checkFieldAccess(scope); - } else { - return super.reportError(scope); - } - } else { - return super.reportError(scope); - } - } + if (!fieldBinding.isValidBinding()) return super.reportError(scope); binding = fieldBinding; return checkFieldAccess(scope); }
diff --git a/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java b/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java index 11c3f67..6c761f6 100644 --- a/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java +++ b/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java
@@ -82,12 +82,12 @@ if ((this.expressionType = this.expression.resolveType(scope)) != null) { TypeBinding javaLangClass = scope.getJavaLangClass(); if (!javaLangClass.isValidBinding()) { - scope.problemReporter().codeSnippetMissingClass("java.lang.Class"/*nonNLS*/, this.sourceStart, this.sourceEnd); + scope.problemReporter().codeSnippetMissingClass("java.lang.Class", this.sourceStart, this.sourceEnd); return; } TypeBinding javaLangObject = scope.getJavaLangObject(); if (!javaLangObject.isValidBinding()) { - scope.problemReporter().codeSnippetMissingClass("java.lang.Object"/*nonNLS*/, this.sourceStart, this.sourceEnd); + scope.problemReporter().codeSnippetMissingClass("java.lang.Object", this.sourceStart, this.sourceEnd); return; } TypeBinding[] argumentTypes = new TypeBinding[] {javaLangObject, javaLangClass};
diff --git a/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java b/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java index 4685837..3f5ae80 100644 --- a/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java +++ b/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java
@@ -17,20 +17,20 @@ public class CodeSnippetSkeleton implements IBinaryType, EvaluationConstants { IBinaryMethod[] methods = new IBinaryMethod[] { new BinaryMethodSkeleton( - "<init>"/*nonNLS*/.toCharArray(), - "()V"/*nonNLS*/.toCharArray(), + "<init>".toCharArray(), + "()V".toCharArray(), new char[][] {}, true ), new BinaryMethodSkeleton( - "run"/*nonNLS*/.toCharArray(), - "()V"/*nonNLS*/.toCharArray(), - new char[][] {"java/lang/Throwable"/*nonNLS*/.toCharArray()}, + "run".toCharArray(), + "()V".toCharArray(), + new char[][] {"java/lang/Throwable".toCharArray()}, false ), new BinaryMethodSkeleton( - "setResult"/*nonNLS*/.toCharArray(), - "(Ljava/lang/Object;Ljava/lang/Class;)V"/*nonNLS*/.toCharArray(), + "setResult".toCharArray(), + "(Ljava/lang/Object;Ljava/lang/Class;)V".toCharArray(), new char[][] {}, false ) @@ -87,7 +87,7 @@ return null; } public char[] getFileName() { - return CharOperation.concat(CODE_SNIPPET_NAME, ".java"/*nonNLS*/.toCharArray()); + return CharOperation.concat(CODE_SNIPPET_NAME, ".java".toCharArray()); } public char[][] getInterfaceNames() { return null; @@ -116,8 +116,4 @@ public boolean isInterface() { return false; } - -public char[] sourceFileName() { - return null; -} }
diff --git a/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java b/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java index 47fe023..ddabe4b 100644 --- a/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java +++ b/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java
@@ -75,6 +75,6 @@ } public String toStringExpression(){ char[] declaringType = this.evaluationContext.declaringTypeName; - return "("/*nonNLS*/ + (declaringType == null ? "<NO DECLARING TYPE>"/*nonNLS*/ : new String(declaringType)) + ")this"/*nonNLS*/; + return "("+ (declaringType == null ? "<NO DECLARING TYPE>" : new String(declaringType)) + ")this"; } }
diff --git a/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java b/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java index fd96616..099e699 100644 --- a/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java +++ b/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java
@@ -66,42 +66,42 @@ // package declaration if (this.packageName != null && this.packageName.length != 0) { - buffer.append("package "/*nonNLS*/); + buffer.append("package "); buffer.append(this.packageName); - buffer.append(";"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); + buffer.append(";").append(JavaModelManager.LINE_SEPARATOR); this.lineNumberOffset++; } // import declarations char[][] imports = this.imports; for (int i = 0; i < imports.length; i++) { - buffer.append("import "/*nonNLS*/); + buffer.append("import "); buffer.append(imports[i]); buffer.append(';').append(JavaModelManager.LINE_SEPARATOR); this.lineNumberOffset++; } // class declaration - buffer.append("public class "/*nonNLS*/); + buffer.append("public class "); buffer.append(this.className); // super class is either a global variable class or the CodeSnippet class if (this.varClassName != null) { - buffer.append(" extends "/*nonNLS*/); + buffer.append(" extends "); buffer.append(this.varClassName); } else { - buffer.append(" extends "/*nonNLS*/); + buffer.append(" extends "); buffer.append(PACKAGE_NAME); - buffer.append("."/*nonNLS*/); + buffer.append("."); buffer.append(ROOT_CLASS_NAME); } - buffer.append(" {"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); + buffer.append(" {").append(JavaModelManager.LINE_SEPARATOR); this.lineNumberOffset++; if (this.declaringTypeName != null){ - buffer.append(" "/*nonNLS*/); + buffer.append(" "); buffer.append(this.declaringTypeName); - buffer.append(" "/*nonNLS*/); + buffer.append(" "); buffer.append(DELEGATE_THIS); // val$this buffer.append(';').append(JavaModelManager.LINE_SEPARATOR); this.lineNumberOffset++; @@ -109,9 +109,9 @@ // add some storage location for local variable persisted state if (localVarNames != null) { for (int i = 0, max = localVarNames.length; i < max; i++) { - buffer.append(" "/*nonNLS*/); + buffer.append(" "); buffer.append(localVarTypeNames[i]); - buffer.append(" "/*nonNLS*/); + buffer.append(" "); buffer.append(LOCAL_VAR_PREFIX); // val$... buffer.append(localVarNames[i]); buffer.append(';').append(JavaModelManager.LINE_SEPARATOR); @@ -119,7 +119,7 @@ } } // run() method declaration - buffer.append("public void run() throws Throwable {"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); + buffer.append("public void run() throws Throwable {").append(JavaModelManager.LINE_SEPARATOR); this.lineNumberOffset++; startPosOffset = buffer.length(); buffer.append(codeSnippet); @@ -173,7 +173,7 @@ // Remove completion on generated method if (CharOperation.equals(declaringTypePackageName, CodeSnippetToCuMapper.this.packageName) && CharOperation.equals(declaringTypeName, CodeSnippetToCuMapper.this.className) - && CharOperation.equals(selector, "run"/*nonNLS*/.toCharArray())) return; + && CharOperation.equals(selector, "run".toCharArray())) return; originalRequestor.acceptMethod(declaringTypePackageName, declaringTypeName, selector, parameterPackageNames, parameterTypeNames, returnTypePackageName, returnTypeName, completionName, modifiers, completionStart - startPosOffset, completionEnd - startPosOffset); } public void acceptModifier(char[] modifierName, int completionStart, int completionEnd) {
diff --git a/eval/org/eclipse/jdt/internal/eval/EvaluationConstants.java b/eval/org/eclipse/jdt/internal/eval/EvaluationConstants.java index 5100445..a4a61fa 100644 --- a/eval/org/eclipse/jdt/internal/eval/EvaluationConstants.java +++ b/eval/org/eclipse/jdt/internal/eval/EvaluationConstants.java
@@ -7,19 +7,19 @@ import org.eclipse.jdt.internal.compiler.util.CharOperation; public interface EvaluationConstants { - public static final char[] CODE_SNIPPET_CLASS_NAME_PREFIX = "CodeSnippet_"/*nonNLS*/.toCharArray(); - public static final char[] GLOBAL_VARS_CLASS_NAME_PREFIX = "GlobalVariables_"/*nonNLS*/.toCharArray(); - public static final char[] PACKAGE_NAME = "org.eclipse.jdt.internal.eval.target"/*nonNLS*/.toCharArray(); - public static final char[] CODE_SNIPPET_NAME = "org/eclipse/jdt/internal/eval/target/CodeSnippet"/*nonNLS*/.toCharArray(); - public static final char[] ROOT_CLASS_NAME = "CodeSnippet"/*nonNLS*/.toCharArray(); - public static final String ROOT_FULL_CLASS_NAME = new String(PACKAGE_NAME) + "."/*nonNLS*/ + new String(ROOT_CLASS_NAME); - public static final char[] SETRESULT_SELECTOR = "setResult"/*nonNLS*/.toCharArray(); - public static final char[] SETRESULT_ARGUMENTS = "Ljava.lang.Object;Ljava.lang.Class;"/*nonNLS*/.toCharArray(); + public static final char[] CODE_SNIPPET_CLASS_NAME_PREFIX = "CodeSnippet_".toCharArray(); + public static final char[] GLOBAL_VARS_CLASS_NAME_PREFIX = "GlobalVariables_".toCharArray(); + public static final char[] PACKAGE_NAME = "org.eclipse.jdt.internal.eval.target".toCharArray(); + public static final char[] CODE_SNIPPET_NAME = "org/eclipse/jdt/internal/eval/target/CodeSnippet".toCharArray(); + public static final char[] ROOT_CLASS_NAME = "CodeSnippet".toCharArray(); + public static final String ROOT_FULL_CLASS_NAME = new String(PACKAGE_NAME) + "." + new String(ROOT_CLASS_NAME); + public static final char[] SETRESULT_SELECTOR = "setResult".toCharArray(); + public static final char[] SETRESULT_ARGUMENTS = "Ljava.lang.Object;Ljava.lang.Class;".toCharArray(); public static final char[][] ROOT_COMPOUND_NAME = CharOperation.arrayConcat(CharOperation.splitOn('.', PACKAGE_NAME), ROOT_CLASS_NAME); - public static final String RUN_METHOD = "run"/*nonNLS*/; - public static final String RESULT_VALUE_FIELD = "resultValue"/*nonNLS*/; - public static final String RESULT_TYPE_FIELD = "resultType"/*nonNLS*/; - public final static char[] LOCAL_VAR_PREFIX = "val$"/*nonNLS*/.toCharArray(); - public final static char[] DELEGATE_THIS = "val$this"/*nonNLS*/.toCharArray(); + public static final String RUN_METHOD = "run"; + public static final String RESULT_VALUE_FIELD = "resultValue"; + public static final String RESULT_TYPE_FIELD = "resultType"; + public final static char[] LOCAL_VAR_PREFIX = "val$".toCharArray(); + public final static char[] DELEGATE_THIS = "val$this".toCharArray(); }
diff --git a/eval/org/eclipse/jdt/internal/eval/EvaluationContext.java b/eval/org/eclipse/jdt/internal/eval/EvaluationContext.java index bf2c011..5fd2936 100644 --- a/eval/org/eclipse/jdt/internal/eval/EvaluationContext.java +++ b/eval/org/eclipse/jdt/internal/eval/EvaluationContext.java
@@ -77,7 +77,7 @@ * set of options used to configure the code assist engine. */ public void complete(char[] codeSnippet, int completionPosition, ISearchableNameEnvironment environment, ICompletionRequestor requestor, ConfigurableOption[] options) { - final char[] className = "CodeSnippetCompletion"/*nonNLS*/.toCharArray(); + final char[] className = "CodeSnippetCompletion".toCharArray(); final CodeSnippetToCuMapper mapper = new CodeSnippetToCuMapper( codeSnippet, this.packageName, @@ -91,7 +91,7 @@ ); ICompilationUnit sourceUnit = new ICompilationUnit() { public char[] getFileName() { - return CharOperation.concat(className, "java"/*nonNLS*/.toCharArray(), '.'); + return CharOperation.concat(className, "java".toCharArray(), '.'); } public char[] getContents() { return mapper.getCUSource(); @@ -204,7 +204,7 @@ if (TIMING) { long start = System.currentTimeMillis(); classes = evaluator.getClasses(); - System.out.println("Time to compile ["/*nonNLS*/ + new String(codeSnippet) + "] was "/*nonNLS*/ + (System.currentTimeMillis() - start) + "ms"/*nonNLS*/); + System.out.println("Time to compile [" + new String(codeSnippet) + "] was " + (System.currentTimeMillis() - start) + "ms"); } else { classes = evaluator.getClasses(); } @@ -309,7 +309,7 @@ if (classes.length > 0) { // Send classes if (!requestor.acceptClassFiles(classes, null)) { - throw new InstallException(); + throw new InstallException("Could not deploy classes for global variables"); } // Remember that the variables have been installed @@ -362,50 +362,50 @@ */ public static String getCodeSnippetSource() { return - "package org.eclipse.jdt.internal.eval.target;\n"/*nonNLS*/ + - "\n"/*nonNLS*/ + - "/*\n"/*nonNLS*/ + - " * (c) Copyright IBM Corp. 2000, 2001.\n"/*nonNLS*/ + - " * All Rights Reserved.\n"/*nonNLS*/ + - " */\n"/*nonNLS*/ + - "/**\n"/*nonNLS*/ + - " * The root of all code snippet classes. Code snippet classes\n"/*nonNLS*/ + - " * are supposed to overide the run() method.\n"/*nonNLS*/ + - " * <p>\n"/*nonNLS*/ + - " * IMPORTANT NOTE:\n"/*nonNLS*/ + - " * All methods in this class must be public since this class is going to be loaded by the\n"/*nonNLS*/ + - " * bootstrap class loader, and the other code snippet support classes might be loaded by \n"/*nonNLS*/ + - " * another class loader (so their runtime packages are going to be different).\n"/*nonNLS*/ + - " */\n"/*nonNLS*/ + - "public class CodeSnippet {\n"/*nonNLS*/ + - " private Class resultType = void.class;\n"/*nonNLS*/ + - " private Object resultValue = null;\n"/*nonNLS*/ + - "/**\n"/*nonNLS*/ + - " * Returns the result type of the code snippet evaluation.\n"/*nonNLS*/ + - " */\n"/*nonNLS*/ + - "public Class getResultType() {\n"/*nonNLS*/ + - " return this.resultType;\n"/*nonNLS*/ + - "}\n"/*nonNLS*/ + - "/**\n"/*nonNLS*/ + - " * Returns the result value of the code snippet evaluation.\n"/*nonNLS*/ + - " */\n"/*nonNLS*/ + - "public Object getResultValue() {\n"/*nonNLS*/ + - " return this.resultValue;\n"/*nonNLS*/ + - "}\n"/*nonNLS*/ + - "/**\n"/*nonNLS*/ + - " * The code snippet. Subclasses must override this method with a transformed code snippet\n"/*nonNLS*/ + - " * that stores the result using setResult(Class, Object).\n"/*nonNLS*/ + - " */\n"/*nonNLS*/ + - "public void run() {\n"/*nonNLS*/ + - "}\n"/*nonNLS*/ + - "/**\n"/*nonNLS*/ + - " * Stores the result type and value of the code snippet evaluation.\n"/*nonNLS*/ + - " */\n"/*nonNLS*/ + - "public void setResult(Object resultValue, Class resultType) {\n"/*nonNLS*/ + - " this.resultValue = resultValue;\n"/*nonNLS*/ + - " this.resultType = resultType;\n"/*nonNLS*/ + - "}\n"/*nonNLS*/ + - "}\n"/*nonNLS*/; + "package org.eclipse.jdt.internal.eval.target;\n" + + "\n" + + "/*\n" + + " * (c) Copyright IBM Corp. 2000, 2001.\n" + + " * All Rights Reserved.\n" + + " */\n" + + "/**\n" + + " * The root of all code snippet classes. Code snippet classes\n" + + " * are supposed to overide the run() method.\n" + + " * <p>\n" + + " * IMPORTANT NOTE:\n" + + " * All methods in this class must be public since this class is going to be loaded by the\n" + + " * bootstrap class loader, and the other code snippet support classes might be loaded by \n" + + " * another class loader (so their runtime packages are going to be different).\n" + + " */\n" + + "public class CodeSnippet {\n" + + " private Class resultType = void.class;\n" + + " private Object resultValue = null;\n" + + "/**\n" + + " * Returns the result type of the code snippet evaluation.\n" + + " */\n" + + "public Class getResultType() {\n" + + " return this.resultType;\n" + + "}\n" + + "/**\n" + + " * Returns the result value of the code snippet evaluation.\n" + + " */\n" + + "public Object getResultValue() {\n" + + " return this.resultValue;\n" + + "}\n" + + "/**\n" + + " * The code snippet. Subclasses must override this method with a transformed code snippet\n" + + " * that stores the result using setResult(Class, Object).\n" + + " */\n" + + "public void run() {\n" + + "}\n" + + "/**\n" + + " * Stores the result type and value of the code snippet evaluation.\n" + + " */\n" + + "public void setResult(Object resultValue, Class resultType) {\n" + + " this.resultValue = resultValue;\n" + + " this.resultType = resultType;\n" + + "}\n" + + "}\n"; } /** * Returns the imports of this evaluation context. An import is the name of a package @@ -440,7 +440,7 @@ private String getSupportClassFileName(String simpleName) { char separator = File.separatorChar; char[][] compoundPackageName = CharOperation.splitOn('.', PACKAGE_NAME); - return new String(CharOperation.concatWith(compoundPackageName, separator)) + separator + simpleName + ".class"/*nonNLS*/; + return new String(CharOperation.concatWith(compoundPackageName, separator)) + separator + simpleName + ".class"; } /** * Creates a new global variable with the given name, type and initializer. @@ -487,7 +487,7 @@ ISelectionRequestor requestor, ConfigurableOption[] options) { - final char[] className = "CodeSnippetSelection"/*nonNLS*/.toCharArray(); + final char[] className = "CodeSnippetSelection".toCharArray(); final CodeSnippetToCuMapper mapper = new CodeSnippetToCuMapper( codeSnippet, this.packageName, @@ -501,7 +501,7 @@ ); ICompilationUnit sourceUnit = new ICompilationUnit() { public char[] getFileName() { - return CharOperation.concat(className, "java"/*nonNLS*/.toCharArray(), '.'); + return CharOperation.concat(className, "java".toCharArray(), '.'); } public char[] getContents() { return mapper.getCUSource();
diff --git a/eval/org/eclipse/jdt/internal/eval/EvaluationResult.java b/eval/org/eclipse/jdt/internal/eval/EvaluationResult.java index e0f7ee3..9d0e961 100644 --- a/eval/org/eclipse/jdt/internal/eval/EvaluationResult.java +++ b/eval/org/eclipse/jdt/internal/eval/EvaluationResult.java
@@ -187,37 +187,37 @@ StringBuffer buffer = new StringBuffer(); switch (this.evaluationType) { case T_CODE_SNIPPET: - buffer.append("Code snippet"/*nonNLS*/); + buffer.append("Code snippet"); break; case T_IMPORT: - buffer.append("Import"/*nonNLS*/); + buffer.append("Import"); break; case T_INTERNAL: - buffer.append("Internal problem"/*nonNLS*/); + buffer.append("Internal problem"); break; case T_PACKAGE: - buffer.append("Package"/*nonNLS*/); + buffer.append("Package"); break; case T_VARIABLE: - buffer.append("Global variable"/*nonNLS*/); + buffer.append("Global variable"); break; } - buffer.append(": "/*nonNLS*/); + buffer.append(": "); buffer.append(this.evaluationID); - buffer.append("\n"/*nonNLS*/); + buffer.append("\n"); if (hasProblems()) { - buffer.append("Problems:\n"/*nonNLS*/); + buffer.append("Problems:\n"); for (int i = 0; i < this.problems.length; i++) { buffer.append(this.problems[i].toString()); } } else { if (hasValue()) { - buffer.append("("/*nonNLS*/); + buffer.append("("); buffer.append(this.typeName); - buffer.append(") "/*nonNLS*/); + buffer.append(") "); buffer.append(this.displayString); } else { - buffer.append("(No explicit return value)"/*nonNLS*/); + buffer.append("(No explicit return value)"); } } return buffer.toString();
diff --git a/eval/org/eclipse/jdt/internal/eval/Evaluator.java b/eval/org/eclipse/jdt/internal/eval/Evaluator.java index f838a69..a04c64c 100644 --- a/eval/org/eclipse/jdt/internal/eval/Evaluator.java +++ b/eval/org/eclipse/jdt/internal/eval/Evaluator.java
@@ -113,7 +113,7 @@ compiler.compile(new ICompilationUnit[] {new ICompilationUnit() { public char[] getFileName() { // Name of class is name of CU - return CharOperation.concat(Evaluator.this.getClassName(), ".java"/*nonNLS*/.toCharArray()); + return CharOperation.concat(Evaluator.this.getClassName(), ".java".toCharArray()); } public char[] getContents() { return source;
diff --git a/eval/org/eclipse/jdt/internal/eval/GlobalVariable.java b/eval/org/eclipse/jdt/internal/eval/GlobalVariable.java index 8b994fa..8811276 100644 --- a/eval/org/eclipse/jdt/internal/eval/GlobalVariable.java +++ b/eval/org/eclipse/jdt/internal/eval/GlobalVariable.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.eval; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A global variable is a variable defined for an evaluation context and that persists - * accross evaluations. - */ public class GlobalVariable { char[] typeName; char[] name; @@ -52,13 +43,13 @@ public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(this.typeName); - buffer.append(" "/*nonNLS*/); + buffer.append(" "); buffer.append(this.name); if (this.initializer != null) { - buffer.append("= "/*nonNLS*/); + buffer.append("= "); buffer.append(this.initializer); } - buffer.append(";"/*nonNLS*/); + buffer.append(";"); return buffer.toString(); } }
diff --git a/eval/org/eclipse/jdt/internal/eval/InstallException.java b/eval/org/eclipse/jdt/internal/eval/InstallException.java index 35286c5..1ee669f 100644 --- a/eval/org/eclipse/jdt/internal/eval/InstallException.java +++ b/eval/org/eclipse/jdt/internal/eval/InstallException.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.eval; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A <code>InstallException</code> is thrown when installing class files on a target has failed - * for any reason. - */ public class InstallException extends Exception { /** * Constructs a <code>InstallException</code> with no detail message.
diff --git a/eval/org/eclipse/jdt/internal/eval/VariablesEvaluator.java b/eval/org/eclipse/jdt/internal/eval/VariablesEvaluator.java index 2e31731..1967713 100644 --- a/eval/org/eclipse/jdt/internal/eval/VariablesEvaluator.java +++ b/eval/org/eclipse/jdt/internal/eval/VariablesEvaluator.java
@@ -176,7 +176,7 @@ // package declaration char[] packageName = getPackageName(); if (packageName.length != 0) { - buffer.append("package "/*nonNLS*/); + buffer.append("package "); buffer.append(packageName); buffer.append(';').append(JavaModelManager.LINE_SEPARATOR); lineNumberOffset++; @@ -185,20 +185,20 @@ // import declarations char[][] imports = this.context.imports; for (int i = 0; i < imports.length; i++) { - buffer.append("import "/*nonNLS*/); + buffer.append("import "); buffer.append(imports[i]); buffer.append(';').append(JavaModelManager.LINE_SEPARATOR); lineNumberOffset++; } // class declaration - buffer.append("public class "/*nonNLS*/); + buffer.append("public class "); buffer.append(getClassName()); - buffer.append(" extends "/*nonNLS*/); + buffer.append(" extends "); buffer.append(PACKAGE_NAME); - buffer.append("."/*nonNLS*/); + buffer.append("."); buffer.append(ROOT_CLASS_NAME); - buffer.append(" {"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); + buffer.append(" {").append(JavaModelManager.LINE_SEPARATOR); lineNumberOffset++; startPosOffset = buffer.length(); @@ -207,10 +207,10 @@ VariablesInfo installedVars = this.context.installedVars; for (int i = 0; i < this.context.variableCount; i++){ GlobalVariable var = vars[i]; - buffer.append("\tpublic static "/*nonNLS*/); + buffer.append("\tpublic static "); var.declarationStart = buffer.length(); buffer.append(var.typeName); - buffer.append(" "/*nonNLS*/); + buffer.append(" "); char[] varName = var.name; buffer.append(varName); buffer.append(';').append(JavaModelManager.LINE_SEPARATOR); @@ -218,7 +218,7 @@ } // field initializations - buffer.append("\tstatic {"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); + buffer.append("\tstatic {").append(JavaModelManager.LINE_SEPARATOR); lineNumberOffset++; for (int i = 0; i < this.context.variableCount; i++){ GlobalVariable var = vars[i]; @@ -228,40 +228,40 @@ // Initialize with initializer if there was no previous value char[] initializer = var.initializer; if (initializer != null) { - buffer.append("\t\ttry {"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); + buffer.append("\t\ttry {").append(JavaModelManager.LINE_SEPARATOR); lineNumberOffset++; var.initializerLineStart = lineNumberOffset; - buffer.append("\t\t\t"/*nonNLS*/); + buffer.append("\t\t\t"); var.initializerStart = buffer.length(); buffer.append(varName); - buffer.append("= "/*nonNLS*/); + buffer.append("= "); var.initExpressionStart = buffer.length(); buffer.append(initializer); lineNumberOffset += numberOfCRs(initializer); buffer.append(';').append(JavaModelManager.LINE_SEPARATOR); - buffer.append("\t\t} catch (Throwable e) {"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); - buffer.append("\t\t\te.printStackTrace();"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); - buffer.append("\t\t}"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); + buffer.append("\t\t} catch (Throwable e) {").append(JavaModelManager.LINE_SEPARATOR); + buffer.append("\t\t\te.printStackTrace();").append(JavaModelManager.LINE_SEPARATOR); + buffer.append("\t\t}").append(JavaModelManager.LINE_SEPARATOR); lineNumberOffset += 4; // 4 CRs } } else { // Initialize with previous value if name and type are the same - buffer.append("\t\t"/*nonNLS*/); + buffer.append("\t\t"); buffer.append(varName); - buffer.append("= "/*nonNLS*/); + buffer.append("= "); char[] installedPackageName = installedVars.packageName; if (installedPackageName != null && installedPackageName.length != 0) { buffer.append(installedPackageName); - buffer.append("."/*nonNLS*/); + buffer.append("."); } buffer.append(installedVars.className); - buffer.append("."/*nonNLS*/); + buffer.append("."); buffer.append(varName); buffer.append(';').append(JavaModelManager.LINE_SEPARATOR); lineNumberOffset++; } } - buffer.append("\t}"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); + buffer.append("\t}").append(JavaModelManager.LINE_SEPARATOR); // end of class declaration buffer.append('}').append(JavaModelManager.LINE_SEPARATOR);
diff --git a/formatter/org/eclipse/jdt/internal/formatter/CodeFormatter.java b/formatter/org/eclipse/jdt/internal/formatter/CodeFormatter.java index af852a8..4c479e3 100644 --- a/formatter/org/eclipse/jdt/internal/formatter/CodeFormatter.java +++ b/formatter/org/eclipse/jdt/internal/formatter/CodeFormatter.java
@@ -366,7 +366,7 @@ && ! (previousCompilableToken == TokenNameRPAREN && token == TokenNameSEMICOLON)) { newLine(1); - currentLineIndentationLevel = indentationLevel; + currentLineIndentationLevel += indentationLevel; pendingNewLines = 0; pendingSpace = false; } else { @@ -1139,127 +1139,127 @@ private String operatorString(int operator) { switch (operator) { case TokenNameextends : - return "extends"/*nonNLS*/; + return "extends"; case TokenNameimplements : - return "implements"/*nonNLS*/; + return "implements"; case TokenNamethrows : - return "throws"/*nonNLS*/; + return "throws"; case TokenNameSEMICOLON : // ; - return ";"/*nonNLS*/; + return ";"; case TokenNameCOMMA : // , - return ","/*nonNLS*/; + return ","; case TokenNameEQUAL : // = - return "="/*nonNLS*/; + return "="; case TokenNameAND_AND : // && (15.22) - return "&&"/*nonNLS*/; + return "&&"; case TokenNameOR_OR : // || (15.23) - return "||"/*nonNLS*/; + return "||"; case TokenNameQUESTION : // ? (15.24) - return "?"/*nonNLS*/; + return "?"; case TokenNameCOLON : // : (15.24) - return ":"/*nonNLS*/; + return ":"; case TokenNameEQUAL_EQUAL : // == (15.20, 15.20.1, 15.20.2, 15.20.3) - return "=="/*nonNLS*/; + return "=="; case TokenNameNOT_EQUAL : // != (15.20, 15.20.1, 15.20.2, 15.20.3) - return "!="/*nonNLS*/; + return "!="; case TokenNameLESS : // < (15.19.1) - return "<"/*nonNLS*/; + return "<"; case TokenNameLESS_EQUAL : // <= (15.19.1) - return "<="/*nonNLS*/; + return "<="; case TokenNameGREATER : // > (15.19.1) - return ">"/*nonNLS*/; + return ">"; case TokenNameGREATER_EQUAL : // >= (15.19.1) - return ">="/*nonNLS*/; + return ">="; case TokenNameinstanceof : // instanceof - return "instanceof"/*nonNLS*/; + return "instanceof"; case TokenNamePLUS : // + (15.17, 15.17.2) - return "+"/*nonNLS*/; + return "+"; case TokenNameMINUS : // - (15.17.2) - return "-"/*nonNLS*/; + return "-"; case TokenNameMULTIPLY : // * (15.16.1) - return "*"/*nonNLS*/; + return "*"; case TokenNameDIVIDE : // / (15.16.2) - return "/"/*nonNLS*/; + return "/"; case TokenNameREMAINDER : // % (15.16.3) - return "%"/*nonNLS*/; + return "%"; case TokenNameLEFT_SHIFT : // << (15.18) - return "<<"/*nonNLS*/; + return "<<"; case TokenNameRIGHT_SHIFT : // >> (15.18) - return ">>"/*nonNLS*/; + return ">>"; case TokenNameUNSIGNED_RIGHT_SHIFT : // >>> (15.18) - return ">>>"/*nonNLS*/; + return ">>>"; case TokenNameAND : // & (15.21, 15.21.1, 15.21.2) - return "&"/*nonNLS*/; + return "&"; case TokenNameOR : // | (15.21, 15.21.1, 15.21.2) - return "|"/*nonNLS*/; + return "|"; case TokenNameXOR : // ^ (15.21, 15.21.1, 15.21.2) - return "^"/*nonNLS*/; + return "^"; case TokenNameMULTIPLY_EQUAL : // *= (15.25.2) - return "*="/*nonNLS*/; + return "*="; case TokenNameDIVIDE_EQUAL : // /= (15.25.2) - return "/="/*nonNLS*/; + return "/="; case TokenNameREMAINDER_EQUAL : // %= (15.25.2) - return "%="/*nonNLS*/; + return "%="; case TokenNamePLUS_EQUAL : // += (15.25.2) - return "+="/*nonNLS*/; + return "+="; case TokenNameMINUS_EQUAL : // -= (15.25.2) - return "-="/*nonNLS*/; + return "-="; case TokenNameLEFT_SHIFT_EQUAL : // <<= (15.25.2) - return "<<="/*nonNLS*/; + return "<<="; case TokenNameRIGHT_SHIFT_EQUAL : // >>= (15.25.2) - return ">>="/*nonNLS*/; + return ">>="; case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>= (15.25.2) - return ">>>="/*nonNLS*/; + return ">>>="; case TokenNameAND_EQUAL : // &= (15.25.2) - return "&="/*nonNLS*/; + return "&="; case TokenNameXOR_EQUAL : // ^= (15.25.2) - return "^="/*nonNLS*/; + return "^="; case TokenNameOR_EQUAL : // |= (15.25.2) - return "|="/*nonNLS*/; + return "|="; case TokenNameDOT : // . - return "."/*nonNLS*/; + return "."; default : - return ""/*nonNLS*/; + return ""; } } /** @@ -1399,7 +1399,7 @@ } } - boolean containsMultiLineComment = currentString.lastIndexOf("/*"/*nonNLS*/) != -1; + boolean containsMultiLineComment = currentString.lastIndexOf("/*") != -1; int numberOfSpaces = 0; int max = currentString.length(); updateMappedPositionsWhileSplitting( @@ -1506,7 +1506,7 @@ if (currentResult.length() != 0 || splitOperators[i] != 0) { int newDepth = - (currentResult.startsWith("/*"/*nonNLS*/) || currentResult.startsWith("//"/*nonNLS*/)) + (currentResult.startsWith("/*") || currentResult.startsWith("//")) ? indentationLevel - 1 : depth; outputLine(
diff --git a/formatter/org/eclipse/jdt/internal/formatter/impl/FormatterOptions.java b/formatter/org/eclipse/jdt/internal/formatter/impl/FormatterOptions.java index fd6b7ae..b91c266 100644 --- a/formatter/org/eclipse/jdt/internal/formatter/impl/FormatterOptions.java +++ b/formatter/org/eclipse/jdt/internal/formatter/impl/FormatterOptions.java
@@ -31,7 +31,7 @@ public boolean compactElseIfMode = false; // if true, else and if are kept on the same line. public boolean newLineInEmptyBlockMode = true; // if false, no new line in {} if it's empty. - public char[] lineSeparatorSequence = System.getProperty("line.separator"/*nonNLS*/).toCharArray(); + public char[] lineSeparatorSequence = System.getProperty("line.separator").toCharArray(); /** * Initializing the formatter options with default settings */ @@ -59,15 +59,15 @@ public ConfigurableOption[] getConfigurableOptions(Locale locale) { String componentName = CodeFormatter.class.getName(); return new ConfigurableOption[] { - new ConfigurableOption(componentName, "newline.openingBrace"/*nonNLS*/, locale, newLineBeforeOpeningBraceMode ? 0 : 1), - new ConfigurableOption(componentName, "newline.controlStatement"/*nonNLS*/, locale, newlineInControlStatementMode ? 0 : 1), - new ConfigurableOption(componentName, "newline.clearAll"/*nonNLS*/, locale, clearAllBlankLinesMode ? 0 : 1), - new ConfigurableOption(componentName, "newline.elseIf"/*nonNLS*/, locale, compactElseIfMode ? 0 : 1), - new ConfigurableOption(componentName, "newline.emptyBlock"/*nonNLS*/, locale, newLineInEmptyBlockMode ? 0 : 1), - new ConfigurableOption(componentName, "line.split"/*nonNLS*/, locale, maxLineLength), - new ConfigurableOption(componentName, "style.compactAssignment"/*nonNLS*/, locale, compactAssignmentMode ? 0 : 1), - new ConfigurableOption(componentName, "tabulation.char"/*nonNLS*/, locale, indentWithTab ? 0 : 1), - new ConfigurableOption(componentName, "tabulation.size"/*nonNLS*/, locale, tabSize) + new ConfigurableOption(componentName, "newline.openingBrace", locale, newLineBeforeOpeningBraceMode ? 0 : 1), + new ConfigurableOption(componentName, "newline.controlStatement", locale, newlineInControlStatementMode ? 0 : 1), + new ConfigurableOption(componentName, "newline.clearAll", locale, clearAllBlankLinesMode ? 0 : 1), + new ConfigurableOption(componentName, "newline.elseIf", locale, compactElseIfMode ? 0 : 1), + new ConfigurableOption(componentName, "newline.emptyBlock", locale, newLineInEmptyBlockMode ? 0 : 1), + new ConfigurableOption(componentName, "line.split", locale, maxLineLength), + new ConfigurableOption(componentName, "style.compactAssignment", locale, compactAssignmentMode ? 0 : 1), + new ConfigurableOption(componentName, "tabulation.char", locale, indentWithTab ? 0 : 1), + new ConfigurableOption(componentName, "tabulation.size", locale, tabSize) }; } /**
diff --git a/formatter/org/eclipse/jdt/internal/formatter/impl/SplitLine.java b/formatter/org/eclipse/jdt/internal/formatter/impl/SplitLine.java index 912da60..7f31846 100644 --- a/formatter/org/eclipse/jdt/internal/formatter/impl/SplitLine.java +++ b/formatter/org/eclipse/jdt/internal/formatter/impl/SplitLine.java
@@ -45,151 +45,151 @@ switch (currentOperator){ case TokenNameextends: - operatorString="extends"/*nonNLS*/; + operatorString="extends"; break; case TokenNameimplements: - operatorString="implements"/*nonNLS*/; + operatorString="implements"; break; case TokenNamethrows: - operatorString="throws"/*nonNLS*/; + operatorString="throws"; break; case TokenNameSEMICOLON : // ; - operatorString=";"/*nonNLS*/; + operatorString=";"; break; case TokenNameCOMMA : // , - operatorString=","/*nonNLS*/; + operatorString=","; break; case TokenNameEQUAL : // = - operatorString="="/*nonNLS*/; + operatorString="="; break; case TokenNameAND_AND : // && (15.22) - operatorString="&&"/*nonNLS*/; + operatorString="&&"; break; case TokenNameOR_OR : // || (15.23) - operatorString="||"/*nonNLS*/; + operatorString="||"; break; case TokenNameQUESTION : // ? (15.24) - operatorString="?"/*nonNLS*/; + operatorString="?"; break; case TokenNameCOLON : // : (15.24) - operatorString=":"/*nonNLS*/; + operatorString=":"; break; case TokenNameEQUAL_EQUAL : // == (15.20, 15.20.1, 15.20.2, 15.20.3) - operatorString="=="/*nonNLS*/; + operatorString="=="; break; case TokenNameNOT_EQUAL : // != (15.20, 15.20.1, 15.20.2, 15.20.3) - operatorString="!="/*nonNLS*/; + operatorString="!="; break; case TokenNameLESS : // < (15.19.1) - operatorString="<"/*nonNLS*/; + operatorString="<"; break; case TokenNameLESS_EQUAL : // <= (15.19.1) - operatorString="<="/*nonNLS*/; + operatorString="<="; break; case TokenNameGREATER : // > (15.19.1) - operatorString=">"/*nonNLS*/; + operatorString=">"; break; case TokenNameGREATER_EQUAL : // >= (15.19.1) - operatorString=">="/*nonNLS*/; + operatorString=">="; break; case TokenNameinstanceof : // instanceof - operatorString="instanceof"/*nonNLS*/; + operatorString="instanceof"; break; case TokenNamePLUS : // + (15.17, 15.17.2) - operatorString="+"/*nonNLS*/; + operatorString="+"; break; case TokenNameMINUS : // - (15.17.2) - operatorString="-"/*nonNLS*/; + operatorString="-"; break; case TokenNameMULTIPLY : // * (15.16.1) - operatorString="*"/*nonNLS*/; + operatorString="*"; break; case TokenNameDIVIDE : // / (15.16.2) - operatorString="/"/*nonNLS*/; + operatorString="/"; break; case TokenNameREMAINDER : // % (15.16.3) - operatorString="%"/*nonNLS*/; + operatorString="%"; break; case TokenNameLEFT_SHIFT : // << (15.18) - operatorString="<<"/*nonNLS*/; + operatorString="<<"; break; case TokenNameRIGHT_SHIFT : // >> (15.18) - operatorString=">>"/*nonNLS*/; + operatorString=">>"; break; case TokenNameUNSIGNED_RIGHT_SHIFT : // >>> (15.18) - operatorString=">>>"/*nonNLS*/; + operatorString=">>>"; break; case TokenNameAND : // & (15.21, 15.21.1, 15.21.2) - operatorString="&"/*nonNLS*/; + operatorString="&"; break; case TokenNameOR : // | (15.21, 15.21.1, 15.21.2) - operatorString="|"/*nonNLS*/; + operatorString="|"; break; case TokenNameXOR : // ^ (15.21, 15.21.1, 15.21.2) - operatorString="^"/*nonNLS*/; + operatorString="^"; break; case TokenNameMULTIPLY_EQUAL : // *= (15.25.2) - operatorString="*="/*nonNLS*/; + operatorString="*="; break; case TokenNameDIVIDE_EQUAL : // /= (15.25.2) - operatorString="/="/*nonNLS*/; + operatorString="/="; break; case TokenNameREMAINDER_EQUAL : // %= (15.25.2) - operatorString="%="/*nonNLS*/; + operatorString="%="; break; case TokenNamePLUS_EQUAL : // += (15.25.2) - operatorString="+="/*nonNLS*/; + operatorString="+="; break; case TokenNameMINUS_EQUAL : // -= (15.25.2) - operatorString="-="/*nonNLS*/; + operatorString="-="; break; case TokenNameLEFT_SHIFT_EQUAL : // <<= (15.25.2) - operatorString="<<="/*nonNLS*/; + operatorString="<<="; break; case TokenNameRIGHT_SHIFT_EQUAL : // >>= (15.25.2) - operatorString=">>="/*nonNLS*/; + operatorString=">>="; break; case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>= (15.25.2) - operatorString=">>>="/*nonNLS*/; + operatorString=">>>="; break; case TokenNameAND_EQUAL : // &= (15.25.2) - operatorString="&="/*nonNLS*/; + operatorString="&="; break; case TokenNameXOR_EQUAL : // ^= (15.25.2) - operatorString="^="/*nonNLS*/; + operatorString="^="; break; case TokenNameOR_EQUAL : // |= (15.25.2) - operatorString="|="/*nonNLS*/; + operatorString="|="; break; case TokenNameDOT : // . - operatorString="."/*nonNLS*/; + operatorString="."; break; default: - operatorString=""/*nonNLS*/; + operatorString=""; } if (placeOperatorAhead){ result.append(operatorString); @@ -200,6 +200,6 @@ } result.append('\n'); } - return ""/*nonNLS*/; + return ""; } }
diff --git a/model/org/eclipse/jdt/core/Flags.java b/model/org/eclipse/jdt/core/Flags.java index b2a1737..fbcabf6 100644 --- a/model/org/eclipse/jdt/core/Flags.java +++ b/model/org/eclipse/jdt/core/Flags.java
@@ -169,20 +169,20 @@ public static String toString(int flags) { StringBuffer sb = new StringBuffer(); - if (isPublic(flags)) sb.append("public "/*nonNLS*/); - if (isProtected(flags)) sb.append("protected "/*nonNLS*/); - if (isPrivate(flags)) sb.append("private "/*nonNLS*/); - if (isStatic(flags)) sb.append("static "/*nonNLS*/); - if (isAbstract(flags)) sb.append("abstract "/*nonNLS*/); - if (isFinal(flags)) sb.append("final "/*nonNLS*/); - if (isNative(flags)) sb.append("native "/*nonNLS*/); - if (isSynchronized(flags)) sb.append("synchronized "/*nonNLS*/); - if (isTransient(flags)) sb.append("transient "/*nonNLS*/); - if (isVolatile(flags)) sb.append("volatile "/*nonNLS*/); - if (isStrictfp(flags)) sb.append("strictfp "/*nonNLS*/); + if (isPublic(flags)) sb.append("public "); + if (isProtected(flags)) sb.append("protected "); + if (isPrivate(flags)) sb.append("private "); + if (isStatic(flags)) sb.append("static "); + if (isAbstract(flags)) sb.append("abstract "); + if (isFinal(flags)) sb.append("final "); + if (isNative(flags)) sb.append("native "); + if (isSynchronized(flags)) sb.append("synchronized "); + if (isTransient(flags)) sb.append("transient "); + if (isVolatile(flags)) sb.append("volatile "); + if (isStrictfp(flags)) sb.append("strictfp "); int len = sb.length(); - if (len == 0) return ""/*nonNLS*/; + if (len == 0) return ""; sb.setLength(len-1); return sb.toString(); }
diff --git a/model/org/eclipse/jdt/core/IBufferChangedListener.java b/model/org/eclipse/jdt/core/IBufferChangedListener.java index 650996a..b716d1b 100644 --- a/model/org/eclipse/jdt/core/IBufferChangedListener.java +++ b/model/org/eclipse/jdt/core/IBufferChangedListener.java
@@ -1,19 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * A listener which gets notified when the contents of a specific buffer - * have changed, or when the buffer is closed. - * When a buffer is closed, the listener is notified <em>after</em> the buffer has been closed. - * A listener is not notified when a buffer is saved. - * <p> - * This interface may be implemented by clients. - * </p> - */ public interface IBufferChangedListener { /**
diff --git a/model/org/eclipse/jdt/core/IClassFile.java b/model/org/eclipse/jdt/core/IClassFile.java index bfb14d3..12451de 100644 --- a/model/org/eclipse/jdt/core/IClassFile.java +++ b/model/org/eclipse/jdt/core/IClassFile.java
@@ -1,30 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents an entire binary type (single <code>.class</code> file). - * A class file has a single child of type <code>IType</code>. - * Class file elements need to be opened before they can be navigated. - * If a class file cannot be parsed, its structure remains unknown. Use - * <code>IJavaElement.isStructureKnown</code> to determine whether this is the - * case. - * <p> - * Note: <code>IClassFile</code> extends <code>ISourceReference</code>. - * Source can be obtained for a class file iff source has been attached to this - * class file. The source associated with a class file is the source code of - * the compilation unit it was (nominally) generated from. - * </p> - * <p> - * This interface is not intended to be implemented by clients. - * </p> - * - * @see IPackageFragmentRoot#attachSource - */ - public interface IClassFile extends IJavaElement, IParent, IOpenable, ISourceReference, ICodeAssist { /** * Returns the smallest element within this class file that @@ -35,10 +10,10 @@ * * @param position a source position inside the class file * @return the innermost Java element enclosing a given source position or <code>null</code> - * if none (excluding the class file). + * if none (excluding the class file). * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource + * exception occurs while accessing its corresponding resource */ IJavaElement getElementAt(int position) throws JavaModelException; /** @@ -47,7 +22,7 @@ * @return the type contained in this class file * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource + * exception occurs while accessing its corresponding resource */ IType getType() throws JavaModelException; /** @@ -57,7 +32,7 @@ * @return <code>true</code> if the class file represents a class. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource + * exception occurs while accessing its corresponding resource */ boolean isClass() throws JavaModelException; /** @@ -67,7 +42,7 @@ * @return <code>true</code> if the class file represents an interface. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource + * exception occurs while accessing its corresponding resource */ boolean isInterface() throws JavaModelException; }
diff --git a/model/org/eclipse/jdt/core/ICodeAssist.java b/model/org/eclipse/jdt/core/ICodeAssist.java index 1daed69..921f25c 100644 --- a/model/org/eclipse/jdt/core/ICodeAssist.java +++ b/model/org/eclipse/jdt/core/ICodeAssist.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Common protocol for Java elements that support source code assist and code - * resolve. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface ICodeAssist { /** * Performs code completion at the given offset position in this compilation unit, @@ -22,13 +10,13 @@ * * @exception JavaModelException if code assist could not be performed. Reasons include:<ul> * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li> - * <li> The position specified is < -1 or is greater than this compilation unit's - * source length (INDEX_OUT_OF_BOUNDS) + * <li> The position specified is < -1 or is greater than this compilation unit's + * source length (INDEX_OUT_OF_BOUNDS) * </ul> * * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code> */ - void codeComplete(int offset, ICodeCompletionRequestor requestor) throws JavaModelException; + void codeComplete(int offset, ICodeCompletionRequestor requestor) throws JavaModelException; /** * Performs code selection on the given selected text in this compilation unit, * reporting results to the given selection requestor. The <code>offset</code> @@ -37,8 +25,8 @@ * * @exception JavaModelException if code resolve could not be performed. Reasons include: * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li> - * <li> The range specified is not within this element's - * source range (INDEX_OUT_OF_BOUNDS) + * <li> The range specified is not within this element's + * source range (INDEX_OUT_OF_BOUNDS) * </ul> * */
diff --git a/model/org/eclipse/jdt/core/ICompilationUnit.java b/model/org/eclipse/jdt/core/ICompilationUnit.java index b0af01e..9ee55c4 100644 --- a/model/org/eclipse/jdt/core/ICompilationUnit.java +++ b/model/org/eclipse/jdt/core/ICompilationUnit.java
@@ -72,7 +72,7 @@ * <li> The name is not a valid package name (INVALID_NAME) * </ul> */ - IPackageDeclaration createPackageDeclaration(String name, IProgressMonitor monitor) throws JavaModelException; + IPackageDeclaration createPackageDeclaration(String name, IProgressMonitor monitor) throws JavaModelException; /** * Creates and returns a type in this compilation unit with the * given contents. If this compilation unit does not exist, one
diff --git a/model/org/eclipse/jdt/core/IElementChangedListener.java b/model/org/eclipse/jdt/core/IElementChangedListener.java index 89e9e8f..3f2b6dc 100644 --- a/model/org/eclipse/jdt/core/IElementChangedListener.java +++ b/model/org/eclipse/jdt/core/IElementChangedListener.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * An element changed listener receives notification of changes to Java elements - * maintained by the Java model. - * <p> - * This interface may be implemented by clients. - * </p> - */ public interface IElementChangedListener { /**
diff --git a/model/org/eclipse/jdt/core/IField.java b/model/org/eclipse/jdt/core/IField.java index 75e869b..184cdbd 100644 --- a/model/org/eclipse/jdt/core/IField.java +++ b/model/org/eclipse/jdt/core/IField.java
@@ -1,16 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents a field declared in a type. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IField extends IMember { /** * Returns the constant value associated with this field @@ -21,7 +10,7 @@ * a <code>Short</code>. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource + * exception occurs while accessing its corresponding resource */ public Object getConstant() throws JavaModelException; /** @@ -33,7 +22,7 @@ * * @see Signature * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource + * exception occurs while accessing its corresponding resource */ String getTypeSignature() throws JavaModelException; }
diff --git a/model/org/eclipse/jdt/core/IImportContainer.java b/model/org/eclipse/jdt/core/IImportContainer.java index dc479c3..735c7de 100644 --- a/model/org/eclipse/jdt/core/IImportContainer.java +++ b/model/org/eclipse/jdt/core/IImportContainer.java
@@ -1,18 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents an import container is a child of a Java compilation unit that contains - * all (and only) the import declarations. If a compilation unit has no import - * declarations, no import container will be present. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IImportContainer extends IJavaElement, IParent, ISourceReference { /** * Returns the first import declaration in this import container with the given name.
diff --git a/model/org/eclipse/jdt/core/IImportDeclaration.java b/model/org/eclipse/jdt/core/IImportDeclaration.java index e4c6a5b..6eac7ea 100644 --- a/model/org/eclipse/jdt/core/IImportDeclaration.java +++ b/model/org/eclipse/jdt/core/IImportDeclaration.java
@@ -1,16 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents an import declaration in Java compilation unit. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IImportDeclaration extends IJavaElement, ISourceReference, ISourceManipulation { /** * Returns the name that has been imported.
diff --git a/model/org/eclipse/jdt/core/IJavaModelMarker.java b/model/org/eclipse/jdt/core/IJavaModelMarker.java index 30af205..e5a4757 100644 --- a/model/org/eclipse/jdt/core/IJavaModelMarker.java +++ b/model/org/eclipse/jdt/core/IJavaModelMarker.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Markers used by the Java model. - * <p> - * This interface declares constants only; it is not intended to be implemented - * or extended. - * </p> - */ public interface IJavaModelMarker { /** @@ -19,7 +7,7 @@ * This can be used to recognize those markers in the workspace that flag problems * detected by the Java tooling during compilation. */ - public static final String JAVA_MODEL_PROBLEM_MARKER = JavaCore.PLUGIN_ID + ".problem"/*nonNLS*/; + public static final String JAVA_MODEL_PROBLEM_MARKER = JavaCore.PLUGIN_ID + ".problem"; /** @@ -28,19 +16,19 @@ * problems detected by the Java tooling (such as a cycle in the build path, a problem * detected by the outliner, or a problem detected during a code completion) */ - public static final String TRANSIENT_PROBLEM = JavaCore.PLUGIN_ID + ".transient_problem"/*nonNLS*/; - + public static final String TRANSIENT_PROBLEM = JavaCore.PLUGIN_ID + ".transient_problem"; + /** * Id marker attribute (value <code>"id"</code>). * Reserved for future use. */ - public static final String ID = "id"/*nonNLS*/; + public static final String ID = "id"; /** * Flags marker attribute (value <code>"flags"</code>). * Reserved for future use. */ - public static final String FLAGS = "flags"/*nonNLS*/; + public static final String FLAGS = "flags"; /** * Cycle detected marker attribute (value <code>"cycleDetected"</code>). @@ -48,11 +36,11 @@ * The value of this attribute is the name of the project that caused a * cycle in the projects classpaths. */ - public static final String CYCLE_DETECTED = "cycleDetected"/*nonNLS*/; + public static final String CYCLE_DETECTED = "cycleDetected"; /** * Build path problem marker type (value <code>"org.eclipse.jdt.core.buildpath_problem"</code>). * This can be used to recognize those markers in the workspace that flag problems * detected by the Java tooling during classpath setting. */ - public static final String BUILDPATH_PROBLEM_MARKER = JavaCore.PLUGIN_ID + ".buildpath_problem"/*nonNLS*/; + public static final String BUILDPATH_PROBLEM_MARKER = JavaCore.PLUGIN_ID + ".buildpath_problem"; }
diff --git a/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java b/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java index 6297996..11ea0fb 100644 --- a/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java +++ b/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java
@@ -1,20 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Status codes used with Java model status objects. - * <p> - * This interface declares constants only; it is not intended to be implemented - * or extended. - * </p> - * - * @see IJavaModelStatus - * @see org.eclipse.core.runtime.IStatus#getCode - */ public interface IJavaModelStatusConstants { /** @@ -29,7 +14,7 @@ * Use <code>getException</code> to retrieve a <code>CoreException</code>. */ public static final int CORE_EXCEPTION = 966; - + /** * Status constant indicating one or more of the elements * supplied are not of a valid type for the operation to @@ -58,14 +43,14 @@ * supplied to the operation. */ public static final int NULL_PATH = 970; - + /** * Status constant indicating that a path outside of the * project was supplied to the operation. The path can be retrieved using * <code>getPath</code> on the status object. */ public static final int PATH_OUTSIDE_PROJECT = 971; - + /** * Status constant indicating that a relative path * was supplied to the operation when an absolute path is @@ -73,7 +58,7 @@ * status object. */ public static final int RELATIVE_PATH = 972; - + /** * Status constant indicating that a path specifying a device * was supplied to the operation when a path with no device is @@ -81,45 +66,45 @@ * status object. */ public static final int DEVICE_PATH = 973; - + /** * Status constant indicating that a string * was supplied to the operation that was <code>null</code>. */ public static final int NULL_STRING = 974; - + /** * Status constant indicating that the operation encountered * a read-only element. * The element(s) can be retrieved using <code>getElements</code> on the status object. */ public static final int READ_ONLY = 976; - + /** * Status constant indicating that a naming collision would occur * if the operation proceeded. */ public static final int NAME_COLLISION = 977; - + /** * Status constant indicating that a destination provided for a copy/move/rename operation * is invalid. * The destination element can be retrieved using <code>getElements</code> on the status object. */ public static final int INVALID_DESTINATION = 978; - + /** * Status constant indicating that a path provided to an operation * is invalid. The path can be retrieved using <code>getPath</code> on the * status object. */ public static final int INVALID_PATH = 979; - + /** * Status constant indicating the given source position is out of bounds. */ public static final int INDEX_OUT_OF_BOUNDS = 980; - + /** * Status constant indicating there is an update conflict * for a working copy. The compilation unit on which the @@ -194,14 +179,14 @@ */ public static final int INVALID_RESOURCE = 995; - /** + /** * Status indicating that a Java element could not be created because * the underlying resource is not of an appropriate type. * @see JavaCore */ public static final int INVALID_RESOURCE_TYPE = 996; - /** + /** * Status indicating that a Java element could not be created because * the project owning underlying resource does not have the Java nature. * @see JavaCore @@ -223,8 +208,4 @@ * has been made locally available. */ public static final int NO_LOCAL_CONTENTS = 999; - /** - * Status constant indicating that a classpath entry was invalid - */ - public static final int INVALID_CLASSPATH = 964; }
diff --git a/model/org/eclipse/jdt/core/IJavaProject.java b/model/org/eclipse/jdt/core/IJavaProject.java index c2434d3..521a3b7 100644 --- a/model/org/eclipse/jdt/core/IJavaProject.java +++ b/model/org/eclipse/jdt/core/IJavaProject.java
@@ -94,6 +94,16 @@ */ IPackageFragmentRoot[] getAllPackageFragmentRoots() throws JavaModelException; /** + * Returns the classpath for the project, as a list of classpath + * entries. + * + * @exception JavaModelException if this element does not exist or if an + * exception occurs while accessing its corresponding resource + * + * @deprecated - since classpath variable support was added either use #getRawClasspath or #getResolvedClasspath + */ +IClasspathEntry[] getClasspath() throws JavaModelException; +/** * Returns an array of non-Java resources directly contained in this project. * It does not transitively answer non-Java resources contained in folders; * these would have to be explicitly iterated over. @@ -228,6 +238,43 @@ */ IEvaluationContext newEvaluationContext(); /** + * Creates and returns a new classpath entry of kind <code>K_BINARY</code> for the JAR + * or folder identified by the given absolute path. This specifies that + * all package fragments within the root will have children of type + * <code>IClassFile</code>. + * The path can be: + * - internal to the workbench: "/Project/binary" + * - external to the workbench: "c:/jdk/classes.zip" + * + * @deprecated - use JavaCore#newLibraryEntry + */ +public IClasspathEntry newLibraryEntry(IPath path); +/** + * Creates and returns a new classpath entry of kind <code>K_SOURCE</code> + * for the project identified by the given absolute path. This + * identifies all the source code of the given project to be + * used in the Java model, and the output location of the project + * to be used when building. + * The path can be: + * - internal to the workbench: "/Project/binary" + * - external to the workbench: "c:/jdk/classes.zip" + * + * @deprecated - use JavaCore#newProjectEntry + */ +public IClasspathEntry newProjectEntry(IPath path); +/** + * Creates and returns a new classpath entry of kind <code>K_SOURCE</code> + * for folder identified by the given absolute path. This specifies that + * all package fragments within the root will have children of type + * <code>ICompilationUnit</code>. + * The path can be: + * - internal to the workbench: "/Project/binary" + * - external to the workbench: "c:/jdk/classes.zip" + * + * @deprecated - use JavaCore#newSourceEntry + */ +public IClasspathEntry newSourceEntry(IPath path); +/** * Creates and returns a type hierarchy for all types in the given * region, considering subtypes within that region. * @@ -248,6 +295,28 @@ */ ITypeHierarchy newTypeHierarchy(IType type, IRegion region, IProgressMonitor monitor) throws JavaModelException; /** + * Sets the classpath of this project. + * <p> + * Setting the classpath to <code>null</code> specifies a default classpath + * (the project root). Setting the classpath to an empty array specifies an + * empty classpath. + * <p> + * If a cycle is detected while setting this classpath, an error marker will be added + * to the project closing the cycle. + * To avoid this problem, use <code>hasClasspathCycle(IClasspathEntry[] entries)</code> + * before setting the classpath. + * + * @exception JavaModelException if the classpath could not be set. Reasons include: + * <ul> + * <li> This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li> + * <li> Two or more entries specify source roots with the same or overlapping paths (NAME_COLLISION) + * <li> A entry of kind <code>CPE_PROJECT</code> refers to this project (INVALID_PATH) + * <li> The classpath is being modified during resource change event notification (CORE_EXCEPTION) + * </ul> + * @deprecated - was renamed to #setRawClasspath + */ +void setClasspath(IClasspathEntry[] entries, IProgressMonitor monitor) throws JavaModelException; +/** * Sets the output location of this project to the location * described by the given absolute path. * <p>
diff --git a/model/org/eclipse/jdt/core/IMember.java b/model/org/eclipse/jdt/core/IMember.java index 634d131..8aee2fe 100644 --- a/model/org/eclipse/jdt/core/IMember.java +++ b/model/org/eclipse/jdt/core/IMember.java
@@ -1,18 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Common protocol for Java elements that can be members of types. - * This set consists of <code>IType</code>, <code>IMethod</code>, - * <code>IField</code>, and <code>IInitializer</code>. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IMember extends IJavaElement, ISourceReference, ISourceManipulation { /** * Returns the class file in which this member is declared, or <code>null</code> @@ -37,7 +24,7 @@ * <code>Flags</code>. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. + * exception occurs while accessing its corresponding resource. * * @see Flags */ @@ -49,7 +36,7 @@ * associated source code (for example, a binary type). * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. + * exception occurs while accessing its corresponding resource. */ ISourceRange getNameRange() throws JavaModelException; /**
diff --git a/model/org/eclipse/jdt/core/IMethod.java b/model/org/eclipse/jdt/core/IMethod.java index f3b6029..8cc01a6 100644 --- a/model/org/eclipse/jdt/core/IMethod.java +++ b/model/org/eclipse/jdt/core/IMethod.java
@@ -1,16 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents a method (or constructor) declared in a type. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IMethod extends IMember { /** * Returns the simple name of this method. @@ -31,7 +20,7 @@ * would return the array <code>{"QIOException;"}</code>. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. + * exception occurs while accessing its corresponding resource. * * @see Signature */ @@ -51,7 +40,7 @@ * would return the array <code>{"text","length"}</code>. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. + * exception occurs while accessing its corresponding resource. */ String[] getParameterNames() throws JavaModelException; /** @@ -73,7 +62,7 @@ * would return <code>"QString;"</code>. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. + * exception occurs while accessing its corresponding resource. * * @see Signature */ @@ -86,7 +75,7 @@ * would return <code>"(QString;I)V"</code>. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. + * exception occurs while accessing its corresponding resource. * * @see Signature */ @@ -95,7 +84,7 @@ * Returns whether this method is a constructor. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. + * exception occurs while accessing its corresponding resource. */ boolean isConstructor() throws JavaModelException; }
diff --git a/model/org/eclipse/jdt/core/IPackageDeclaration.java b/model/org/eclipse/jdt/core/IPackageDeclaration.java index fc1418e..b3723df 100644 --- a/model/org/eclipse/jdt/core/IPackageDeclaration.java +++ b/model/org/eclipse/jdt/core/IPackageDeclaration.java
@@ -1,16 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents a package declaration in Java compilation unit. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IPackageDeclaration extends IJavaElement, ISourceReference { /** * Returns the name of the package the statement refers to.
diff --git a/model/org/eclipse/jdt/core/IPackageFragment.java b/model/org/eclipse/jdt/core/IPackageFragment.java index fde463d..4f5c0f3 100644 --- a/model/org/eclipse/jdt/core/IPackageFragment.java +++ b/model/org/eclipse/jdt/core/IPackageFragment.java
@@ -31,7 +31,7 @@ * string, <code>""</code>). * </p> */ - public static final String DEFAULT_PACKAGE_NAME = ""/*nonNLS*/; + public static final String DEFAULT_PACKAGE_NAME = ""; /** * Returns whether this fragment contains at least one Java resource. */
diff --git a/model/org/eclipse/jdt/core/IPackageFragmentRoot.java b/model/org/eclipse/jdt/core/IPackageFragmentRoot.java index ed893af..4304ae8 100644 --- a/model/org/eclipse/jdt/core/IPackageFragmentRoot.java +++ b/model/org/eclipse/jdt/core/IPackageFragmentRoot.java
@@ -40,7 +40,7 @@ /** * Empty root path */ - String DEFAULT_PACKAGEROOT_PATH = ""/*nonNLS*/; + String DEFAULT_PACKAGEROOT_PATH = ""; /** * Attaches the source archive identified by the given absolute path to this
diff --git a/model/org/eclipse/jdt/core/IParent.java b/model/org/eclipse/jdt/core/IParent.java index c01d74b..ef06f37 100644 --- a/model/org/eclipse/jdt/core/IParent.java +++ b/model/org/eclipse/jdt/core/IParent.java
@@ -1,16 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; - -/** - * Common protocol for Java elements that contain other Java elements. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ + public interface IParent { /** * Returns the immediate children of this element. @@ -18,7 +7,7 @@ * the children are in no particular order. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource + * exception occurs while accessing its corresponding resource */ IJavaElement[] getChildren() throws JavaModelException; /** @@ -27,7 +16,7 @@ * testing whether <code>getChildren</code> is an empty array. * * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource + * exception occurs while accessing its corresponding resource */ boolean hasChildren() throws JavaModelException; }
diff --git a/model/org/eclipse/jdt/core/IRegion.java b/model/org/eclipse/jdt/core/IRegion.java index 06dc491..aedb33f 100644 --- a/model/org/eclipse/jdt/core/IRegion.java +++ b/model/org/eclipse/jdt/core/IRegion.java
@@ -1,28 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * A Java model region describes a hierarchical set of elements. - * Regions are often used to describe a set of elements to be considered - * when performing operations; for example, the set of elements to be - * considered during a search. A region may include elements from different - * projects. - * <p> - * When an element is included in a region, all of its children - * are considered to be included. Children of an included element - * <b>cannot</b> be selectively excluded. - * </p> - * <p> - * This interface is not intended to be implemented by clients. - * Instances can be created via the <code>JavaCore.newRegion</code>. - * </p> - * - * @see JavaCore#newRegion - */ public interface IRegion { /** * Adds the given element and all of its descendents to this region.
diff --git a/model/org/eclipse/jdt/core/ISourceRange.java b/model/org/eclipse/jdt/core/ISourceRange.java index 2c9dd03..9fced64 100644 --- a/model/org/eclipse/jdt/core/ISourceRange.java +++ b/model/org/eclipse/jdt/core/ISourceRange.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * A source range defines an element's source coordinates relative to - * its source buffer. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface ISourceRange { /**
diff --git a/model/org/eclipse/jdt/core/ISourceReference.java b/model/org/eclipse/jdt/core/ISourceReference.java index 9b5dd16..0228695 100644 --- a/model/org/eclipse/jdt/core/ISourceReference.java +++ b/model/org/eclipse/jdt/core/ISourceReference.java
@@ -1,32 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Common protocol for Java elements that have associated source code. - * This set consists of <code>IClassFile</code>, <code>ICompilationUnit</code>, - * <code>IPackageDeclaration</code>, <code>IImportDeclaration</code>, - * <code>IImportContainer</code>, <code>IType</code>, <code>IField</code>, - * <code>IMethod</code>, and <code>IInitializer</code>. - * </ul> - * <p> - * Note: For <code>IClassFile</code>, <code>IType</code> and other members - * derived from a binary type, the implementation returns source iff the - * element has attached source code. - * </p> - * <p> - * Source reference elements may be working copies if they were created from - * a compilation unit that is a working copy. - * </p> - * <p> - * This interface is not intended to be implemented by clients. - * </p> - * - * @see IPackageFragmentRoot#attachSource - */ public interface ISourceReference { /** * Returns the source code associated with this element. @@ -41,7 +14,7 @@ * @return the source code, or <code>null</code> if this element has no * associated source code * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource + * exception occurs while accessing its corresponding resource */ String getSource() throws JavaModelException; /** @@ -54,7 +27,7 @@ * @return the source range, or <code>null</code> if if this element has no * associated source code * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource + * exception occurs while accessing its corresponding resource */ ISourceRange getSourceRange() throws JavaModelException; }
diff --git a/model/org/eclipse/jdt/core/ITypeHierarchyChangedListener.java b/model/org/eclipse/jdt/core/ITypeHierarchyChangedListener.java index 2356e04..cf59398 100644 --- a/model/org/eclipse/jdt/core/ITypeHierarchyChangedListener.java +++ b/model/org/eclipse/jdt/core/ITypeHierarchyChangedListener.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * A listener which gets notified when a particular type hierarchy object - * changes. - * <p> - * This interface may be implemented by clients. - * </p> - */ public interface ITypeHierarchyChangedListener { /** * Notifies that the given type hierarchy has changed in some way and should
diff --git a/model/org/eclipse/jdt/core/JavaConventions.java b/model/org/eclipse/jdt/core/JavaConventions.java index 9e7fdcd..15c7a0f 100644 --- a/model/org/eclipse/jdt/core/JavaConventions.java +++ b/model/org/eclipse/jdt/core/JavaConventions.java
@@ -5,6 +5,9 @@ * All Rights Reserved. */ +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Status; import org.eclipse.jdt.internal.compiler.parser.InvalidInputException; import org.eclipse.jdt.internal.compiler.parser.Scanner; @@ -14,11 +17,7 @@ import java.util.StringTokenizer; -import org.eclipse.jdt.internal.core.JavaModelStatus; -import org.eclipse.core.runtime.*; -import java.io.File; -import org.eclipse.jdt.internal.core.*; -import org.eclipse.core.resources.*; +import org.eclipse.jdt.internal.core.Util; /** * Provides methods for checking Java-specific conventions such as name syntax. @@ -29,7 +28,7 @@ */ public final class JavaConventions { private final static char fgDot= '.'; - private final static String fgJAVA= "JAVA"/*nonNLS*/; + private final static String fgJAVA= "JAVA"; /** * Not instantiable. */ @@ -48,8 +47,8 @@ } String extension1 = rootPath1.getFileExtension(); String extension2 = rootPath2.getFileExtension(); - String jarExtension = "JAR"/*nonNLS*/; - String zipExtension = "ZIP"/*nonNLS*/; + String jarExtension = "JAR"; + String zipExtension = "ZIP"; if (extension1 != null && (extension1.equalsIgnoreCase(jarExtension) || extension1.equalsIgnoreCase(zipExtension))) { return false; } @@ -111,14 +110,14 @@ */ public static IStatus validateCompilationUnitName(String name) { if (name == null) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.nullName"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "Compilation unit name must not be null", null); } String extension; String identifier; int index; index = name.indexOf('.'); if (index == -1) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "Compilation unit name must include the \".java\" suffix", null); } identifier = name.substring(0, index); extension = name.substring(index + 1); @@ -127,9 +126,9 @@ return status; } if (!Util.isJavaFileName(name)) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "Compilation unit name must include the \".java\" suffix", null); } - return new Status(IStatus.OK, JavaCore.PLUGIN_ID, -1, "OK"/*nonNLS*/, null); + return new Status(IStatus.OK, JavaCore.PLUGIN_ID, -1, "OK", null); } /** * Validate the given field name. @@ -159,9 +158,9 @@ */ public static IStatus validateIdentifier(String id) { if (scannedIdentifier(id) != null) { - return new Status(IStatus.OK, JavaCore.PLUGIN_ID, -1, "OK"/*nonNLS*/, null); + return new Status(IStatus.OK, JavaCore.PLUGIN_ID, -1, "OK", null); } else { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier"/*nonNLS*/, id), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, id + " is not a valid Java identifier", null); } } /** @@ -178,13 +177,13 @@ */ public static IStatus validateImportDeclaration(String name) { if (name == null || name.length() == 0) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.import.nullImport"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "An import declaration must not be null", null);; } if (name.charAt(name.length() - 1) == '*') { if (name.charAt(name.length() - 2) == '.') { return validatePackageName(name.substring(0, name.length() - 2)); } else { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.import.unqualifiedImport"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "An import declaration must not end with an unqualified *", null);; } } return validatePackageName(name); @@ -204,11 +203,11 @@ */ public static IStatus validateJavaTypeName(String name) { if (name == null) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.nullName"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "A Java type name must not be null", null); } String trimmed = name.trim(); if (!name.equals(trimmed)) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.nameWithBlanks"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "A Java type name must not start or end with a blank.", null);; } int index = name.lastIndexOf('.'); char[] scannedID; @@ -228,14 +227,14 @@ if (scannedID != null) { if (CharOperation.contains('$', scannedID)) { - return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.dollarName"/*nonNLS*/), null); + return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, "By convention, Java type names usually don't contain the $ character.", null); } if ((scannedID.length > 0 && Character.isLowerCase(scannedID[0]))) { - return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.lowercaseName"/*nonNLS*/), null); + return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, "By convention, Java type names usually start with an uppercase letter.", null); } - return new Status(IStatus.OK, JavaCore.PLUGIN_ID, -1, "OK"/*nonNLS*/, null); + return new Status(IStatus.OK, JavaCore.PLUGIN_ID, -1, "OK", null); } else { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.invalidName"/*nonNLS*/, name), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "The type name " + name + " is not a valid identifier.", null); } } /** @@ -266,22 +265,22 @@ */ public static IStatus validatePackageName(String name) { if (name == null) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.nullName"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "A package name must not be null", null); } int length; if ((length = name.length()) == 0) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.emptyName"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "A package name must not be empty", null); } if (name.charAt(0) == fgDot || name.charAt(length-1) == fgDot) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.dotName"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "A package name cannot start or end with a dot", null); } if (Character.isWhitespace(name.charAt(0)) || Character.isWhitespace(name.charAt(name.length() - 1))) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.nameWithBlanks"/*nonNLS*/), null);; + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "A package name must not start or end with a blank", null);; } int dot = 0; while (dot != -1 && dot < length-1) { if ((dot = name.indexOf(fgDot, dot+1)) != -1 && dot < length-1 && name.charAt(dot+1) == fgDot) { - return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.consecutiveDotsName"/*nonNLS*/), null); + return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "A package name must not contain two consecutive dots", null); } } StringTokenizer st = new StringTokenizer(name, new String(new char[] {fgDot})); @@ -293,178 +292,6 @@ return status; } } - return new Status(IStatus.OK, JavaCore.PLUGIN_ID, -1, "OK"/*nonNLS*/, null); -} - -/** - * Validate the given classpath and output location. - * - Source folders cannot be nested inside the binary output, and reciprocally. They can coincidate. - * - Source folders cannot be nested in each other. - * - Output location must be nested inside project. - - * @param classpath a given classpath - * @param outputLocation a given output location - * @return a status object with code <code>IStatus.OK</code> if - * the given classpath and output location are compatible, otherwise a status - * object indicating what is wrong with the classpath or output location - */ -public static IJavaModelStatus validateClasspath(IJavaProject javaProject, IClasspathEntry[] classpath, IPath outputLocation) { - - IProject project = javaProject.getProject(); - IPath projectPath= project.getFullPath(); - - /* validate output location */ - if (outputLocation == null) { - return new JavaModelStatus(IJavaModelStatusConstants.NULL_PATH); - } - if (outputLocation.isAbsolute()) { - if (!projectPath.isPrefixOf(outputLocation)) { - return new JavaModelStatus(IJavaModelStatusConstants.PATH_OUTSIDE_PROJECT, javaProject, outputLocation.toString()); - } - } else { - return new JavaModelStatus(IJavaModelStatusConstants.RELATIVE_PATH, outputLocation); - } - - - - // check if any source entries coincidates with binary output - in which case nesting inside output is legal - boolean allowNestingInOutput = false; - boolean hasSource = false; - for (int i = 0 ; i < classpath.length; i++) { - if (classpath[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) hasSource = true; - if (classpath[i].getPath().equals(outputLocation)){ - allowNestingInOutput = true; - break; - } - } - if (!hasSource) allowNestingInOutput = true; // if no source, then allowed - - // check all entries - for (int i = 0 ; i < classpath.length; i++) { - IClasspathEntry entry = classpath[i]; - IPath entryPath = entry.getPath(); - - // no further check if entry coincidates with project or output location - if (entryPath.equals(projectPath)) continue; - if (entryPath.equals(outputLocation)) continue; - - // prevent nesting source entries in each other - if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE){ - for (int j = 0; j < classpath.length; j++){ - IClasspathEntry otherEntry = classpath[j]; - if (entry != otherEntry && otherEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE){ - if (entryPath.isPrefixOf(otherEntry.getPath())){ - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestSourceFolderInSource"/*nonNLS*/,entryPath.toString(), otherEntry.getPath().toString())); - } - } - } - } - // prevent nesting output location inside entry - if (entryPath.isPrefixOf(outputLocation)) { - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestSourceFolderInOutput"/*nonNLS*/,entryPath.toString(), outputLocation.toString())); - } - - // prevent nesting entry inside output location - when distinct from project or a source folder - if (!allowNestingInOutput && outputLocation.isPrefixOf(entryPath)) { - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.cannotNestOuputInSourceFolder"/*nonNLS*/, outputLocation.toString(), entryPath.toString())); - } - } - return JavaModelStatus.VERIFIED_OK; -} - - /** - * Returns a message describing the problem related to this classpath entry if any, or null if entry is fine - * (i.e. if the given classpath entry denotes a valid element to be referenced onto a classpath). - */ - public static IJavaModelStatus validateClasspathEntry(IJavaProject javaProject, IClasspathEntry entry, boolean checkSourceAttachment){ - - IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); - IPath path = entry.getPath(); - - switch(entry.getEntryKind()){ - - // variable entry check - case IClasspathEntry.CPE_VARIABLE : - if (path != null && path.segmentCount() >= 1){ - entry = JavaCore.getResolvedClasspathEntry(entry); - if (entry == null){ - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundVariablePath"/*nonNLS*/, path.toString())); - } - return validateClasspathEntry(javaProject, entry, checkSourceAttachment); - } else { - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalVariablePath"/*nonNLS*/, path.toString())); - } - - // library entry check - case IClasspathEntry.CPE_LIBRARY : - if (path != null && path.isAbsolute() && !path.isEmpty()) { - IPath sourceAttachment = entry.getSourceAttachmentPath(); - Object target = JavaModel.getTarget(workspaceRoot, path, true); - if (target instanceof IResource){ - IResource resolvedResource = (IResource) target; - switch(resolvedResource.getType()){ - case IResource.FILE : - String extension = resolvedResource.getFileExtension(); - if ("jar"/*nonNLS*/.equalsIgnoreCase(extension) || "zip"/*nonNLS*/.equalsIgnoreCase(extension)){ // internal binary archive - if (checkSourceAttachment - && sourceAttachment != null - && !sourceAttachment.isEmpty() - && JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){ - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment"/*nonNLS*/, sourceAttachment.toString())); - } - } - break; - case IResource.FOLDER : // internal binary folder - if (checkSourceAttachment - && sourceAttachment != null - && !sourceAttachment.isEmpty() - && JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){ - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment"/*nonNLS*/, sourceAttachment.toString())); - } - } - } else if (target instanceof File){ - if (checkSourceAttachment - && sourceAttachment != null - && !sourceAttachment.isEmpty() - && JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){ - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment"/*nonNLS*/, sourceAttachment.toString())); - } - } else { - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundLibrary"/*nonNLS*/, path.toString())); - } - } else { - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalLibraryPath"/*nonNLS*/, path.toString())); - } - break; - - // project entry check - case IClasspathEntry.CPE_PROJECT : - if (path != null && path.isAbsolute() && !path.isEmpty()) { - IProject project = workspaceRoot.getProject(path.segment(0)); - try { - if (!project.exists() || !project.hasNature(JavaCore.NATURE_ID)){ - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundProject"/*nonNLS*/, path.segment(0).toString())); - } - } catch (CoreException e){ - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundProject"/*nonNLS*/, path.segment(0).toString())); - } - } else { - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalProjectPath"/*nonNLS*/, path.segment(0).toString())); - } - break; - - // project source folder - case IClasspathEntry.CPE_SOURCE : - if (path != null && path.isAbsolute() && !path.isEmpty()) { - IPath projectPath= javaProject.getProject().getFullPath(); - if (!projectPath.isPrefixOf(path) || JavaModel.getTarget(workspaceRoot, path, true) == null){ - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceFolder"/*nonNLS*/, path.toString())); - } - } else { - return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalSourceFolderPath"/*nonNLS*/, path.toString())); - } - break; - } - return JavaModelStatus.VERIFIED_OK; + return new Status(IStatus.OK, JavaCore.PLUGIN_ID, -1, "OK", null); } }
diff --git a/model/org/eclipse/jdt/core/JavaCore.java b/model/org/eclipse/jdt/core/JavaCore.java index 7ad19d2..0db3ddb 100644 --- a/model/org/eclipse/jdt/core/JavaCore.java +++ b/model/org/eclipse/jdt/core/JavaCore.java
@@ -9,7 +9,6 @@ import org.eclipse.core.resources.*; import java.io.*; -import java.net.URL; import java.util.*; import org.eclipse.jdt.internal.compiler.*; @@ -45,19 +44,19 @@ * The plug-in identifier of the Java core support * (value <code>"org.eclipse.jdt.core"</code>). */ - public static final String PLUGIN_ID = "org.eclipse.jdt.core"/*nonNLS*/; // getPlugin().getDescriptor().getUniqueIdentifier(); + public static final String PLUGIN_ID = "org.eclipse.jdt.core"; // getPlugin().getDescriptor().getUniqueIdentifier(); /** * The identifier for the Java builder * (value <code>"org.eclipse.jdt.core.javabuilder"</code>). */ - public static final String BUILDER_ID = PLUGIN_ID + ".javabuilder"/*nonNLS*/; + public static final String BUILDER_ID = PLUGIN_ID + ".javabuilder"; /** * The identifier for the Java model * (value <code>"org.eclipse.jdt.core.javamodel"</code>). */ - public static final String MODEL_ID = PLUGIN_ID + ".javamodel"/*nonNLS*/; + public static final String MODEL_ID = PLUGIN_ID + ".javamodel"; /** * The identifier for the Java nature @@ -67,82 +66,76 @@ * * @see org.eclipse.core.resources.IProject#hasNature */ - public static final String NATURE_ID = PLUGIN_ID + ".javanature"/*nonNLS*/; + public static final String NATURE_ID = PLUGIN_ID + ".javanature"; /** * Name of the handle id attribute in a Java marker */ - private static final String ATT_HANDLE_ID= "org.eclipse.jdt.internal.core.JavaModelManager.handleId"/*nonNLS*/; + private static final String ATT_HANDLE_ID= "org.eclipse.jdt.internal.core.JavaModelManager.handleId"; /** * Names of recognized configurable options */ - public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + ".compiler.debug.localVariable"/*nonNLS*/; + public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + ".compiler.debug.localVariable"; // possible values are GENERATE or DO_NOT_GENERATE (default is DO_NOT_GENERATE) - public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + ".compiler.debug.lineNumber"/*nonNLS*/; + public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + ".compiler.debug.lineNumber"; // possible values are GENERATE or DO_NOT_GENERATE (default is GENERATE) - public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + ".compiler.debug.sourceFile"/*nonNLS*/; + public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + ".compiler.debug.sourceFile"; // possible values are GENERATE or DO_NOT_GENERATE (default is GENERATE) - public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + ".compiler.codegen.unusedLocal"/*nonNLS*/; + public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + ".compiler.codegen.unusedLocal"; // possible values are PRESERVE or OPTIMIZE_OUT (default is OPTIMIZE_OUT) - public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"/*nonNLS*/; + public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"; // possible values are VERSION_1_1 or VERSION_1_2 (default is VERSION_1_1) - public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"/*nonNLS*/; + public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"; // possible values are ERROR or WARNING (default is ERROR) - public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + ".compiler.problem.invalidImport"/*nonNLS*/; + public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + ".compiler.problem.invalidImport"; // possible values are ERROR or WARNING (default is ERROR) - public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + ".compiler.problem.overridingPackageDefaultMethod"/*nonNLS*/; + public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + ".compiler.problem.overridingPackageDefaultMethod"; // possible values are WARNING or IGNORE (default is WARNING) - public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"/*nonNLS*/; + public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"; // possible values are WARNING or IGNORE (default is WARNING) - public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + ".compiler.problem.deprecation"/*nonNLS*/; + public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + ".compiler.problem.deprecation"; // possible values are WARNING or IGNORE (default is WARNING) - public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenCatchBlock"/*nonNLS*/; + public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenCatchBlock"; // possible values are WARNING or IGNORE (default is WARNING) - public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"/*nonNLS*/; + public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"; // possible values are WARNING or IGNORE (default is WARNING) - public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"/*nonNLS*/; + public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"; // possible values are WARNING or IGNORE (default is WARNING) - public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + ".compiler.problem.syntheticAccessEmulation"/*nonNLS*/; - // possible values are WARNING or IGNORE (default is IGNORE) - - public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"/*nonNLS*/; + public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + ".compiler.problem.syntheticAccessEmulation"; + // possible values are WARNING or IGNORE (default is IGNORE) + + public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"; // possible values are COMPUTE or IGNORE (default is COMPUTE) /** * Possible values for configurable options */ - public static final String GENERATE = "generate"/*nonNLS*/; - public static final String DO_NOT_GENERATE = "do not generate"/*nonNLS*/; - public static final String PRESERVE = "preserve"/*nonNLS*/; - public static final String OPTIMIZE_OUT = "optimize out"/*nonNLS*/; - public static final String VERSION_1_1 = "1.1"/*nonNLS*/; - public static final String VERSION_1_2 = "1.2"/*nonNLS*/; - public static final String ERROR = "error"/*nonNLS*/; - public static final String WARNING = "warning"/*nonNLS*/; - public static final String IGNORE = "ignore"/*nonNLS*/; - public static final String COMPUTE = "compute"/*nonNLS*/; + public static final String GENERATE = "generate"; + public static final String DO_NOT_GENERATE = "do not generate"; + public static final String PRESERVE = "preserve"; + public static final String OPTIMIZE_OUT = "optimize out"; + public static final String VERSION_1_1 = "1.1"; + public static final String VERSION_1_2 = "1.2"; + public static final String ERROR = "error"; + public static final String WARNING = "warning"; + public static final String IGNORE = "ignore"; + public static final String COMPUTE = "compute"; private static Hashtable ConfigurableOptions; private static Hashtable Variables = new Hashtable(5); - // possible values are WARNING or IGNORE (default is IGNORE) - - public static final String COMPILER_PB_NON_EXTERNALIZED_STRING_LITERAL = PLUGIN_ID + ".compiler.problem.nonExternalizedStringLiteral"/*nonNLS*/; - - private static Hashtable DefaultOptions; - private final static String PropertiesBundleName = "org.eclipse.jdt.core.JavaCore"/*nonNLS*/; /** * Creates the Java core plug-in. */ @@ -223,11 +216,11 @@ String extension= file.getProjectRelativePath().getFileExtension(); if (extension != null) { extension= extension.toLowerCase(); - if (extension.equals("java"/*nonNLS*/)) { + if (extension.equals("java")) { return createCompilationUnitFrom(file); - } else if (extension.equals("class"/*nonNLS*/)) { + } else if (extension.equals("class")) { return createClassFileFrom(file); - } else if (extension.equals("jar"/*nonNLS*/) || extension.equals("zip"/*nonNLS*/)) { + } else if (extension.equals("jar") || extension.equals("zip")) { return createJarPackageFragmentRootFrom(file); } } @@ -419,7 +412,7 @@ } pkgName.append(segment); if (j < pkgPath.segmentCount() - 1) { - pkgName.append("."/*nonNLS*/); + pkgName.append("."); } } return root.getPackageFragment(pkgName.toString()); @@ -468,33 +461,105 @@ /** * Answers a set of configurable options with their default values. * These options allow to configure the behavior of the underlying components. + * + * Recognized options are listed below, optionName = possibleValue1 / possibleValue2 + * where [] are enclosing the default value of the corresponding option. + * + * Note: more options might be added in further releases. + * + * RECOGNIZED OPTIONS: + * + * COMPILER_LOCAL_VARIABLE_ATTR = [GENERATE] | DO_NOT_GENERATE + * When generated, this attribute will enable local variable names to be displayed + * in debugger, only in place where variables are definitely assigned + * (.class file is then bigger) + * + * COMPILER_LINE_NUMBER_ATTR = [GENERATE] | DO_NOT_GENERATE + * When generated, this attribute will enable source code highlighting in debugger + * (.class file is then bigger). + * + * COMPILER_SOURCE_FILE_ATTR = [GENERATE] | DO_NOT_GENERATE + * When generated, this attribute will enable the debugger to present the + * corresponding source code. + * + * COMPILER_CODEGEN_UNUSED_LOCAL = [PRESERVE] | OPTIMIZE_OUT + * Unless requested to preserve unused local variables (i.e. never read), the + * compiler will optimize them out, potentially altering debugging + * + * COMPILER_CODEGEN_TARGET_PLATFORM = [VERSION_1_1] | VERSION_1_2 + * Generate .class files either backward compatible with JVM 1.1 or only executable + * on JVM 1.2 and later + * + * COMPILER_PB_UNREACHABLE_CODE = [ERROR] | WARNING + * Unreachable code can either be reported as an error or a warning + * + * COMPILER_PB_INVALID_IMPORT = [ERROR] | WARNING + * An import statement that cannot be resolved might either be reported + * either as an error or as a warning + * + * COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = [WARNING] | IGNORE + * A package default method is not visible in a different package, and thus + * cannot be overriden. When enabling this option, the compiler will signal + * such scenarii. + * + * COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = [WARNING] | IGNORE + * Naming a method with a constructor name is generally considered poor + * style programming. When enabling this option, the compiler will signal such + * scenarii + * + * COMPILER_PB_DEPRECATION = [WARNING] | IGNORE + * When enabled, the compiler will signal use of deprecated API. + * + * COMPILER_PB_HIDDEN_CATCH_BLOCK = [WARNING] | IGNORE + * Locally to a try statement, some catch blocks may hide others + * (e.g. try { throw new java.io.CharConversionException(); + * } catch (java.io.CharConversionException e) { + * } catch (java.io.IOException e) {}). + * When enabling this option, the compiler will issue a warning for hidden catch + * blocks corresponding to checked exceptions + * + * COMPILER_PB_UNUSED_LOCAL = WARNING | [IGNORE] + * When enabled, the compiler will issue a warning for unused local variables + * (i.e. variables never read from) + * + * COMPILER_PB_UNUSED_PARAMETER = WARNING | [IGNORE] + * When enabled, the compiler will issue a warning for unused method parameters + * (i.e. parameters never read from) + * + * COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = WARNING | [IGNORE] + * When enabled, the compiler will issue a warning whenever it emulates access + * to a non-accessible member of an enclosing type + * + * CORE_JAVA_BUILD_ORDER = [COMPUTE] | IGNORE + * When enabled, the build order is automatically reflecting the classpath on each + * classpath change action. It can still be modified manually afterwards. */ + public static Hashtable getDefaultOptions(){ - if (DefaultOptions == null) { - DefaultOptions = new Hashtable(10); - - try{ - ResourceBundle bundle = - ResourceBundle.getBundle(PropertiesBundleName,Locale.getDefault()); - - Enumeration enum = bundle.getKeys(); - while(enum.hasMoreElements()){ - String id = (String)enum.nextElement(); - System.out.println(id); - DefaultOptions.put(id,bundle.getString(id)); - } - } catch(Exception ex){} - } - return (Hashtable)DefaultOptions.clone(); - - + Hashtable defaultOptions = new Hashtable(10); + + // Compiler settings + defaultOptions.put(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE); + defaultOptions.put(COMPILER_LINE_NUMBER_ATTR, GENERATE); + defaultOptions.put(COMPILER_SOURCE_FILE_ATTR, GENERATE); + defaultOptions.put(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE); + defaultOptions.put(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1); + defaultOptions.put(COMPILER_PB_UNREACHABLE_CODE, ERROR); + defaultOptions.put(COMPILER_PB_INVALID_IMPORT, ERROR); + defaultOptions.put(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, WARNING); + defaultOptions.put(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, WARNING); + defaultOptions.put(COMPILER_PB_DEPRECATION, WARNING); + defaultOptions.put(COMPILER_PB_HIDDEN_CATCH_BLOCK, WARNING); + defaultOptions.put(COMPILER_PB_UNUSED_LOCAL, IGNORE); + defaultOptions.put(COMPILER_PB_UNUSED_PARAMETER, IGNORE); + defaultOptions.put(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION, IGNORE); + + // JavaCore settings + defaultOptions.put(CORE_JAVA_BUILD_ORDER, IGNORE); + + return defaultOptions; } - -private static IPath getInstallLocation() { - return new Path(getPlugin().getDescriptor().getInstallURL().getFile()); -} - /** * Returns the single instance of the Java core plug-in runtime class. * Equivalent to <code>(JavaCore) getPlugin()</code>. @@ -575,7 +640,7 @@ return JavaCore.newProjectEntry(resolvedPath); // internal project case IResource.FILE : String extension = resolvedResource.getFileExtension(); - if ("jar"/*nonNLS*/.equalsIgnoreCase(extension) || "zip"/*nonNLS*/.equalsIgnoreCase(extension)){ // internal binary archive + if ("jar".equalsIgnoreCase(extension) || "zip".equalsIgnoreCase(extension)){ // internal binary archive return JavaCore.newLibraryEntry( resolvedPath, getResolvedVariablePath(entry.getSourceAttachmentPath()), @@ -595,7 +660,7 @@ File externalFile = (File) target; if (externalFile.isFile()){ String fileName = externalFile.getName().toLowerCase(); - if (fileName.endsWith(".jar"/*nonNLS*/) || fileName.endsWith(".zip"/*nonNLS*/)){ // external binary archive + if (fileName.endsWith(".jar") || fileName.endsWith(".zip")){ // external binary archive return JavaCore.newLibraryEntry( resolvedPath, getResolvedVariablePath(entry.getSourceAttachmentPath()), @@ -686,7 +751,7 @@ */ public static IClasspathEntry newLibraryEntry(IPath path, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath) { - Assert.isTrue(path.isAbsolute(), Util.bind("classpath.needAbsolutePath"/*nonNLS*/)); + Assert.isTrue(path.isAbsolute(), "path for IClasspathEntry must be absolute"); return new ClasspathEntry( IPackageFragmentRoot.K_BINARY, IClasspathEntry.CPE_LIBRARY, @@ -708,7 +773,7 @@ * The prerequisite project is referred to using an absolute path relative to the workspace root. */ public static IClasspathEntry newProjectEntry(IPath path){ - Assert.isTrue(path.isAbsolute(), Util.bind("classpath.needAbsolutePath"/*nonNLS*/)); + Assert.isTrue(path.isAbsolute(), "path for IClasspathEntry must be absolute"); return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE, IClasspathEntry.CPE_PROJECT, path, null, null); } /** @@ -728,7 +793,7 @@ * context of the containing project (a source entry "Proj1/src" cannot be used on the classpath of Proj2). */ public static IClasspathEntry newSourceEntry(IPath path){ - Assert.isTrue(path.isAbsolute(), Util.bind("classpath.needAbsolutePath"/*nonNLS*/)); + Assert.isTrue(path.isAbsolute(), "path for IClasspathEntry must be absolute"); return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE, IClasspathEntry.CPE_SOURCE, path, null, null); } /** @@ -761,7 +826,7 @@ * or <code>null</code> if <code>archivePath</code> is also <code>null</code> */ public static IClasspathEntry newVariableEntry(IPath variablePath, IPath variableSourceAttachmentPath, IPath sourceAttachmentRootPath){ - Assert.isTrue(variablePath != null && variablePath.segmentCount() >= 1, Util.bind("classpath.illegalVariablePath"/*nonNLS*/)); + Assert.isTrue(variablePath != null && variablePath.segmentCount() >= 1, "invalid variable path"); return new ClasspathEntry( IPackageFragmentRoot.K_SOURCE, IClasspathEntry.CPE_VARIABLE, @@ -855,7 +920,7 @@ */ public static void setClasspathVariable(String variableName, IPath path, IProgressMonitor monitor) throws JavaModelException { - Assert.isTrue(path != null, Util.bind("classpath.nullVariablePath"/*nonNLS*/)); + Assert.isTrue(path != null, "variable path cannot be null"); updateVariableValue(variableName, path, monitor); } /* (non-Javadoc) @@ -1004,5 +1069,4 @@ } } } - }
diff --git a/model/org/eclipse/jdt/core/JavaModelException.java b/model/org/eclipse/jdt/core/JavaModelException.java index e7017e5..29df1e6 100644 --- a/model/org/eclipse/jdt/core/JavaModelException.java +++ b/model/org/eclipse/jdt/core/JavaModelException.java
@@ -98,13 +98,13 @@ */ public String toString() { StringBuffer buffer= new StringBuffer(); - buffer.append("Java Model Exception: "/*nonNLS*/); + buffer.append("Java Model Exception: "); if (getException() != null) { if (getException() instanceof CoreException) { CoreException c= (CoreException)getException(); - buffer.append("Core Exception [code "/*nonNLS*/); + buffer.append("Core Exception [code "); buffer.append(c.getStatus().getCode()); - buffer.append("] "/*nonNLS*/); + buffer.append("] "); buffer.append(c.getStatus().getMessage()); } else { buffer.append(getException().toString());
diff --git a/model/org/eclipse/jdt/core/Signature.java b/model/org/eclipse/jdt/core/Signature.java index 7a870dd..a9f96ea 100644 --- a/model/org/eclipse/jdt/core/Signature.java +++ b/model/org/eclipse/jdt/core/Signature.java
@@ -173,54 +173,54 @@ * String constant for the signature of the primitive type boolean. * Value is <code>"Z"</code>. */ - public static final String SIG_BOOLEAN = "Z"/*nonNLS*/; + public static final String SIG_BOOLEAN = "Z"; /** * String constant for the signature of the primitive type byte. * Value is <code>"B"</code>. */ - public static final String SIG_BYTE = "B"/*nonNLS*/; + public static final String SIG_BYTE = "B"; /** * String constant for the signature of the primitive type char. * Value is <code>"C"</code>. */ - public static final String SIG_CHAR = "C"/*nonNLS*/; + public static final String SIG_CHAR = "C"; /** * String constant for the signature of the primitive type double. * Value is <code>"D"</code>. */ - public static final String SIG_DOUBLE = "D"/*nonNLS*/; + public static final String SIG_DOUBLE = "D"; /** * String constant for the signature of the primitive type float. * Value is <code>"F"</code>. */ - public static final String SIG_FLOAT = "F"/*nonNLS*/; + public static final String SIG_FLOAT = "F"; /** * String constant for the signature of the primitive type int. * Value is <code>"I"</code>. */ - public static final String SIG_INT = "I"/*nonNLS*/; + public static final String SIG_INT = "I"; /** * String constant for the signature of the primitive type long. * Value is <code>"J"</code>. */ - public static final String SIG_LONG = "J"/*nonNLS*/; + public static final String SIG_LONG = "J"; /** * String constant for the signature of the primitive type short. * Value is <code>"S"</code>. */ - public static final String SIG_SHORT = "S"/*nonNLS*/; + public static final String SIG_SHORT = "S"; /** String constant for the signature of result type void. * Value is <code>"V"</code>. */ - public static final String SIG_VOID = "V"/*nonNLS*/; + public static final String SIG_VOID = "V"; /** * Not instantiable. @@ -236,7 +236,7 @@ StringBuffer sb = new StringBuffer(typeName.length() + arrayCount * 2); sb.append(typeName); for (int i = 0; i < arrayCount; ++i) { - sb.append("[]"/*nonNLS*/); + sb.append("[]"); } return sb.toString(); } @@ -302,7 +302,7 @@ return SIG_VOID; case 6 : if (typeName[0] == 'S' && typeName[1] == 't' && typeName[2] == 'r' && typeName[3] == 'i' && typeName[4] == 'n' && typeName[5] == 'g') - if (!isResolved) return "QString;"/*nonNLS*/; + if (!isResolved) return "QString;"; break; case 7 : if (typeName[0] == 'b' && typeName[1] == 'o' && typeName[2] == 'o' && typeName[3] == 'l' && typeName[4] == 'e' && typeName[5] == 'a' && typeName[6] == 'n') @@ -617,7 +617,7 @@ public static String getQualifier(String name) { int lastDot = name.lastIndexOf(C_DOT); if (lastDot == -1) { - return ""/*nonNLS*/; + return ""; } return name.substring(0, lastDot); } @@ -715,7 +715,7 @@ */ public static String toQualifiedName(String[] segments) { if (segments.length == 0) { - return ""/*nonNLS*/; + return ""; } if (segments.length == 1) { return segments[0]; @@ -755,28 +755,28 @@ public static String toString(String signature) throws IllegalArgumentException { try { if (signature.charAt(0) == C_PARAM_START) { - return toString(signature, ""/*nonNLS*/, null, true, true); + return toString(signature, "", null, true, true); } int arrayCount = getArrayCount(signature); switch (signature.charAt(arrayCount)) { case C_BOOLEAN : - return arrayIfy("boolean"/*nonNLS*/, arrayCount); + return arrayIfy("boolean", arrayCount); case C_BYTE : - return arrayIfy("byte"/*nonNLS*/, arrayCount); + return arrayIfy("byte", arrayCount); case C_CHAR : - return arrayIfy("char"/*nonNLS*/, arrayCount); + return arrayIfy("char", arrayCount); case C_DOUBLE : - return arrayIfy("double"/*nonNLS*/, arrayCount); + return arrayIfy("double", arrayCount); case C_FLOAT : - return arrayIfy("float"/*nonNLS*/, arrayCount); + return arrayIfy("float", arrayCount); case C_INT : - return arrayIfy("int"/*nonNLS*/, arrayCount); + return arrayIfy("int", arrayCount); case C_LONG : - return arrayIfy("long"/*nonNLS*/, arrayCount); + return arrayIfy("long", arrayCount); case C_SHORT : - return arrayIfy("short"/*nonNLS*/, arrayCount); + return arrayIfy("short", arrayCount); case C_VOID : - return arrayIfy("void"/*nonNLS*/, arrayCount); + return arrayIfy("void", arrayCount); case C_RESOLVED : case C_UNRESOLVED : int semi = signature.indexOf(C_SEMICOLON, arrayCount + 1); @@ -838,7 +838,7 @@ sb.append(C_PARAM_START); for (int i = 0; i < paramTypes.length; ++i) { if (i != 0) - sb.append(", "/*nonNLS*/); + sb.append(", "); String readableParamType = toString(paramTypes[i]); if (!fullyQualifyTypeNames) { int lastDot = readableParamType.lastIndexOf(C_DOT);
diff --git a/model/org/eclipse/jdt/core/eval/IGlobalVariable.java b/model/org/eclipse/jdt/core/eval/IGlobalVariable.java index 76d45d7..fa2ea0c 100644 --- a/model/org/eclipse/jdt/core/eval/IGlobalVariable.java +++ b/model/org/eclipse/jdt/core/eval/IGlobalVariable.java
@@ -1,19 +1,5 @@ package org.eclipse.jdt.core.eval; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * A global variable declared in an evaluation context. - * <p> - * This interface is not intended to be implemented by clients. - * <code>IEvaluationContext.newVariable</code> can be used to obtain an instance. - * </p> - * - * @see IEvaluationContext#newVariable - */ public interface IGlobalVariable { /** * Returns the initializer of this global variable.
diff --git a/model/org/eclipse/jdt/core/jdom/DOMException.java b/model/org/eclipse/jdt/core/jdom/DOMException.java index 7d18370..9a382d1 100644 --- a/model/org/eclipse/jdt/core/jdom/DOMException.java +++ b/model/org/eclipse/jdt/core/jdom/DOMException.java
@@ -1,16 +1,5 @@ package org.eclipse.jdt.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Unchecked exception thrown when an illegal manipulation of the JDOM is - * performed, or when an attempt is made to access/set an attribute of a - * JDOM node that source indexes cannot be determined for (in case the source - * was syntactically incorrect). - */ public class DOMException extends RuntimeException { /** * Creates a new exception with no detail message.
diff --git a/model/org/eclipse/jdt/core/jdom/DOMFactory.java b/model/org/eclipse/jdt/core/jdom/DOMFactory.java index bb56111..a556c48 100644 --- a/model/org/eclipse/jdt/core/jdom/DOMFactory.java +++ b/model/org/eclipse/jdt/core/jdom/DOMFactory.java
@@ -47,7 +47,7 @@ * Method declared on IDOMFactory. */ public IDOMField createField() { - return createField("Object aField;"/*nonNLS*/+ JavaModelManager.LINE_SEPARATOR); + return createField("Object aField;"+ JavaModelManager.LINE_SEPARATOR); } /* (non-Javadoc) * Method declared on IDOMFactory. @@ -77,7 +77,7 @@ * Method declared on IDOMFactory. */ public IDOMInitializer createInitializer() { - return createInitializer("static {}"/*nonNLS*/+ JavaModelManager.LINE_SEPARATOR); + return createInitializer("static {}"+ JavaModelManager.LINE_SEPARATOR); } /* (non-Javadoc) * Method declared on IDOMFactory. @@ -92,7 +92,7 @@ * Method declared on IDOMFactory. */ public IDOMMethod createMethod() { - return createMethod("public void newMethod() {"/*nonNLS*/+ JavaModelManager.LINE_SEPARATOR+"}"/*nonNLS*/+ JavaModelManager.LINE_SEPARATOR); + return createMethod("public void newMethod() {"+ JavaModelManager.LINE_SEPARATOR+"}"+ JavaModelManager.LINE_SEPARATOR); } /* (non-Javadoc) * Method declared on IDOMFactory. @@ -122,7 +122,7 @@ * Method declared on IDOMFactory. */ public IDOMType createType() { - return createType("public class AClass {"/*nonNLS*/+ JavaModelManager.LINE_SEPARATOR +"}"/*nonNLS*/+ JavaModelManager.LINE_SEPARATOR); + return createType("public class AClass {"+ JavaModelManager.LINE_SEPARATOR +"}"+ JavaModelManager.LINE_SEPARATOR); } /* (non-Javadoc) * Method declared on IDOMFactory.
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMCompilationUnit.java b/model/org/eclipse/jdt/core/jdom/IDOMCompilationUnit.java index 83a6eac..e9702c1 100644 --- a/model/org/eclipse/jdt/core/jdom/IDOMCompilationUnit.java +++ b/model/org/eclipse/jdt/core/jdom/IDOMCompilationUnit.java
@@ -1,19 +1,5 @@ package org.eclipse.jdt.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents a Java compilation unit (<code>.java</code> source file). - * The corresponding syntactic unit is CompilationUnit (JLS2 7.3). - * Allowable child types for a compilation unit are <code>IDOMPackage</code>, <code>IDOMImport</code>, - * and <code>IDOMType</code>. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IDOMCompilationUnit extends IDOMNode { /** * Returns the header comment for this compilation unit. The header comment
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMFactory.java b/model/org/eclipse/jdt/core/jdom/IDOMFactory.java index 9a5669a..878df04 100644 --- a/model/org/eclipse/jdt/core/jdom/IDOMFactory.java +++ b/model/org/eclipse/jdt/core/jdom/IDOMFactory.java
@@ -1,48 +1,5 @@ package org.eclipse.jdt.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * A factory used to create document fragment (DF) nodes. An - * <code>IDOMCompilationUnit</code> represents the root of a complete JDOM (that - * is, a ".java" file). Other node types represent fragments of a compilation - * unit. - * <p> - * The factory can be used to create empty DFs or it can create DFs from source - * strings. All DFs created empty are assigned default values as required, such - * that a call to <code>IDOMNode.getContents</code> will generate a valid source - * string. See individual <code>create</code> methods for details on the default - * values supplied. The factory does its best to recognize Java structures in - * the source provided. If the factory is completely unable to recognize source - * constructs, the factory method returns <code>null</code>. - * </p> - * <p> - * Even if a DF is created successfully from source code, it does not guarantee - * that the source code will compile error free. Similary, the contents of a DF - * are not guaranteed to compile error free. However, syntactically correct - * source code is guaranteed to be recognized and successfully generate a DF. - * Similarly, if all of the fragments of a JDOM are syntactically correct, the - * contents of the entire document will be correct too. - * </p> - * <p> - * The factory does not perform or provide any code formatting. Document - * fragments created on source strings must be pre-formatted. The JDOM attempts - * to maintain the formatting of documents as best as possible. For this reason, - * document fragments created for nodes that are to be strung together should - * end with a new-line character. Failing to do so will result in a document - * that has elements strung together on the same line. This is especially - * important if a source string ends with a // comment. In this case, it would - * be syntactically incorrect to omit the new line character. - * </p> - * <p> - * This interface is not intended to be implemented by clients. - * </p> - * - * @see IDOMNode - */ public interface IDOMFactory { /** * Creates and return an empty JDOM. The initial content is an empty string.
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMField.java b/model/org/eclipse/jdt/core/jdom/IDOMField.java index 9799b73..c623cfc 100644 --- a/model/org/eclipse/jdt/core/jdom/IDOMField.java +++ b/model/org/eclipse/jdt/core/jdom/IDOMField.java
@@ -1,19 +1,5 @@ package org.eclipse.jdt.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents a field declaration. The corresponding - * syntactic units are FieldDeclaration (JLS2 8.3) and ConstantDeclaration - * (JLS2 9.3) restricted to a single VariableDeclarator clause. - * A field has no children. The parent of a field is a type. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IDOMField extends IDOMMember { /** * Returns the initializer expression for this field.
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMImport.java b/model/org/eclipse/jdt/core/jdom/IDOMImport.java index c7596dd..fc56e6a 100644 --- a/model/org/eclipse/jdt/core/jdom/IDOMImport.java +++ b/model/org/eclipse/jdt/core/jdom/IDOMImport.java
@@ -1,18 +1,5 @@ package org.eclipse.jdt.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents an import declaration. - * The corresponding syntactic unit is ImportDeclaration (JLS2 7.5). - * An import has no children and its parent is a compilation unit. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IDOMImport extends IDOMNode { /** * The <code>IDOMImport</code> refinement of this <code>IDOMNode</code>
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMInitializer.java b/model/org/eclipse/jdt/core/jdom/IDOMInitializer.java index beb3c51..a8f82f4 100644 --- a/model/org/eclipse/jdt/core/jdom/IDOMInitializer.java +++ b/model/org/eclipse/jdt/core/jdom/IDOMInitializer.java
@@ -1,18 +1,5 @@ package org.eclipse.jdt.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents an initializer. The corresponding syntactic - * units are InstanceInitializer (JLS2 8.6) and StaticDeclaration (JLS2 8.7). - * An initializer has no children and its parent is a type. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IDOMInitializer extends IDOMMember { /** * Returns the body of this initializer. The syntax for a body corresponds to
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMMember.java b/model/org/eclipse/jdt/core/jdom/IDOMMember.java index 916b1a2..6cb9542 100644 --- a/model/org/eclipse/jdt/core/jdom/IDOMMember.java +++ b/model/org/eclipse/jdt/core/jdom/IDOMMember.java
@@ -1,22 +1,5 @@ package org.eclipse.jdt.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * An <code>IDOMMember</code> defines functionality common to nodes which - * can be members of types. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - * - * @see IDOMType - * @see IDOMMethod - * @see IDOMField - * @see IDOMInitializer - */ public interface IDOMMember extends IDOMNode { /** * Returns the comment associated with this member (including comment delimiters).
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMMethod.java b/model/org/eclipse/jdt/core/jdom/IDOMMethod.java index c9b1b14..a0b53d3 100644 --- a/model/org/eclipse/jdt/core/jdom/IDOMMethod.java +++ b/model/org/eclipse/jdt/core/jdom/IDOMMethod.java
@@ -1,20 +1,5 @@ package org.eclipse.jdt.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents a method declaration. - * The corresponding syntactic units are MethodDeclaration (JLS2 8.4), - * ConstructorDeclaration (JLS2 8.8), and AbstractMethodDeclaration (JLS2 9.4). - * A method has no children and its parent is a type. - * Local classes are considered to be part of the body of a method, not a child. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IDOMMethod extends IDOMMember { /** * Adds the given exception to the end of the list of exceptions this method
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMPackage.java b/model/org/eclipse/jdt/core/jdom/IDOMPackage.java index 861cb91..5231e29 100644 --- a/model/org/eclipse/jdt/core/jdom/IDOMPackage.java +++ b/model/org/eclipse/jdt/core/jdom/IDOMPackage.java
@@ -1,18 +1,5 @@ package org.eclipse.jdt.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents a package declaration. - * The corresponding syntactic unit is PackageDeclaration (JLS2 7.4). - * A Package has no children, and its parent is a compilation unit. - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IDOMPackage extends IDOMNode { /** * The <code>IDOMPackage</code> refinement of this <code>IDOMNode</code>
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMType.java b/model/org/eclipse/jdt/core/jdom/IDOMType.java index 17a5f1a..d5c1c2b 100644 --- a/model/org/eclipse/jdt/core/jdom/IDOMType.java +++ b/model/org/eclipse/jdt/core/jdom/IDOMType.java
@@ -1,23 +1,5 @@ package org.eclipse.jdt.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.internal.core.*; -/** - * Represents a source type in a compilation unit, either as a top-level type or a member type. - * The corresponding syntactic units are ClassDeclaration (JLS2 8.1) and InterfaceDeclaration (JLS2 9.1). - * <p> - * Allowable child types for a type are <code>IDOMType</code>, <code>IDOMField</code>, - * <code>IDOMMethod</code>, and <code>IDOMInitializer</code>. - * Children are listed in the order in which they appear in the source. The parent of a type - * is a type (in the case of a member type) or a compilation unit (in the case of a top-level type). - * </p> - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ public interface IDOMType extends IDOMMember { /** * Adds the given interface name to the names of interfaces that this type implements or extends
diff --git a/model/org/eclipse/jdt/internal/core/Assert.java b/model/org/eclipse/jdt/internal/core/Assert.java index 707494c..f90627e 100644 --- a/model/org/eclipse/jdt/internal/core/Assert.java +++ b/model/org/eclipse/jdt/internal/core/Assert.java
@@ -19,7 +19,7 @@ * @exception IllegalArgumentException if the legality test failed */ public static boolean isLegal(boolean expression) { - return isLegal(expression, ""/*nonNLS*/); + return isLegal(expression, ""); } /** Asserts that an argument is legal. If the given boolean is * not <code>true</code>, an <code>IllegalArgumentException</code> @@ -44,7 +44,7 @@ * @exception IllegalArgumentException if the object is <code>null</code> */ public static void isNotNull(Object object) { - isNotNull(object, ""/*nonNLS*/); + isNotNull(object, ""); } /** Asserts that the given object is not <code>null</code>. If this * is not the case, some kind of unchecked exception is thrown. @@ -56,7 +56,7 @@ */ public static void isNotNull(Object object, String message) { if (object == null) - throw new AssertionFailedException(Util.bind("assert.nullArgument"/*nonNLS*/,message)); + throw new AssertionFailedException("null argument;" + message); } /** Asserts that the given boolean is <code>true</code>. If this * is not the case, some kind of unchecked exception is thrown. @@ -66,7 +66,7 @@ * if the check fails) */ public static boolean isTrue(boolean expression) { - return isTrue(expression, ""/*nonNLS*/); + return isTrue(expression, ""); } /** Asserts that the given boolean is <code>true</code>. If this * is not the case, some kind of unchecked exception is thrown. @@ -79,7 +79,7 @@ */ public static boolean isTrue(boolean expression, String message) { if (!expression) - throw new AssertionFailedException(Util.bind("assert.failed"/*nonNLS*/, message)); + throw new AssertionFailedException("assertion failed; "+message); return expression; }
diff --git a/model/org/eclipse/jdt/internal/core/BasicCompilationUnit.java b/model/org/eclipse/jdt/internal/core/BasicCompilationUnit.java index 7f9ec67..87113dc 100644 --- a/model/org/eclipse/jdt/internal/core/BasicCompilationUnit.java +++ b/model/org/eclipse/jdt/internal/core/BasicCompilationUnit.java
@@ -21,11 +21,11 @@ this.contents = contents; this.fileName = fileName.toCharArray(); - int start = fileName.lastIndexOf("/"/*nonNLS*/) + 1; - if (start == 0 || start < fileName.lastIndexOf("\\"/*nonNLS*/)) - start = fileName.lastIndexOf("\\"/*nonNLS*/) + 1; + int start = fileName.lastIndexOf("/") + 1; + if (start == 0 || start < fileName.lastIndexOf("\\")) + start = fileName.lastIndexOf("\\") + 1; - int end = fileName.lastIndexOf("."/*nonNLS*/); + int end = fileName.lastIndexOf("."); if (end == -1) end = fileName.length(); @@ -75,6 +75,6 @@ return mainTypeName; } public String toString(){ - return "CompilationUnit: "/*nonNLS*/+new String(fileName); + return "CompilationUnit: "+new String(fileName); } }
diff --git a/model/org/eclipse/jdt/internal/core/BinaryMethod.java b/model/org/eclipse/jdt/internal/core/BinaryMethod.java index 0616e24..a593da8 100644 --- a/model/org/eclipse/jdt/internal/core/BinaryMethod.java +++ b/model/org/eclipse/jdt/internal/core/BinaryMethod.java
@@ -110,7 +110,7 @@ int paramCount = Signature.getParameterCount(new String(info.getMethodDescriptor())); fParameterNames = new String[paramCount]; for (int i = 0; i < paramCount; i++) { - fParameterNames[i] = "arg"/*nonNLS*/ + i; + fParameterNames[i] = "arg" + i; } } return fParameterNames; @@ -151,18 +151,18 @@ public String readableName() { StringBuffer buffer = new StringBuffer(super.readableName()); - buffer.append("("/*nonNLS*/); + buffer.append("("); String[] parameterTypes = this.getParameterTypes(); int length; if (parameterTypes != null && (length = parameterTypes.length) > 0) { for (int i = 0; i < length; i++) { buffer.append(Signature.toString(parameterTypes[i])); if (i < length - 1) { - buffer.append(", "/*nonNLS*/); + buffer.append(", "); } } } - buffer.append(")"/*nonNLS*/); + buffer.append(")"); return buffer.toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/BinaryType.java b/model/org/eclipse/jdt/internal/core/BinaryType.java index 49dbcaf..4c72cc7 100644 --- a/model/org/eclipse/jdt/internal/core/BinaryType.java +++ b/model/org/eclipse/jdt/internal/core/BinaryType.java
@@ -109,7 +109,7 @@ return null; } enclosingTypeName = ClassFile.unqualifiedName(enclosingTypeName); - return getPackageFragment().getClassFile(new String(enclosingTypeName) + ".class"/*nonNLS*/).getType(); + return getPackageFragment().getClassFile(new String(enclosingTypeName) + ".class").getType(); } catch (JavaModelException npe) { return null; } @@ -231,7 +231,7 @@ * @see IType#getType */ public IType getType(String name) { - IClassFile classFile= getPackageFragment().getClassFile(getTypeQualifiedName() + "$"/*nonNLS*/ + name + ".class"/*nonNLS*/); + IClassFile classFile= getPackageFragment().getClassFile(getTypeQualifiedName() + "$" + name + ".class"); return new BinaryType(classFile, name); } /** @@ -302,7 +302,7 @@ */ public ITypeHierarchy newTypeHierarchy(IJavaProject project, IProgressMonitor monitor) throws JavaModelException { if (project == null) { - throw new IllegalArgumentException(Util.bind("hierarchy.nullProject"/*nonNLS*/)); + throw new IllegalArgumentException("project argument cannot be null"); } CreateTypeHierarchyOperation op= new CreateTypeHierarchyOperation( this,
diff --git a/model/org/eclipse/jdt/internal/core/Buffer.java b/model/org/eclipse/jdt/internal/core/Buffer.java index 150909f..4cf8c55 100644 --- a/model/org/eclipse/jdt/internal/core/Buffer.java +++ b/model/org/eclipse/jdt/internal/core/Buffer.java
@@ -166,8 +166,8 @@ char currentChar = nextChar; nextChar = i < length-1 ? text[i+1] : ' '; switch (currentChar) { - case '\n': return "\n"/*nonNLS*/; - case '\r': return nextChar == '\n' ? "\r\n"/*nonNLS*/ : "\r"/*nonNLS*/; + case '\n': return "\n"; + case '\r': return nextChar == '\n' ? "\r\n" : "\r"; } } } @@ -208,7 +208,7 @@ */ public String getContents() { if (fContents == null) - return ""/*nonNLS*/; + return ""; synchronized (fLock) { if (fGapStart < 0) { return new String(fContents); @@ -261,7 +261,7 @@ */ public String getText(int offset, int length) { if (fContents == null) - return ""/*nonNLS*/; + return ""; synchronized (fLock) { if (offset + length < fGapStart) return new String(fContents, offset, length); @@ -616,19 +616,19 @@ char[] contents = this.getCharacters(); int length = contents.length; StringBuffer buffer = new StringBuffer(length); - buffer.append("Buffer:\n"/*nonNLS*/); + buffer.append("Buffer:\n"); for (int i = 0; i < length; i++) { char car = contents[i]; switch (car) { case '\n': - buffer.append("\\n\n"/*nonNLS*/); + buffer.append("\\n\n"); break; case '\r': if (i < length-1 && contents[i+1] == '\n') { - buffer.append("\\r\\n\n"/*nonNLS*/); + buffer.append("\\r\\n\n"); i++; } else { - buffer.append("\\r\n"/*nonNLS*/); + buffer.append("\\r\n"); } break; default:
diff --git a/model/org/eclipse/jdt/internal/core/ClassFile.java b/model/org/eclipse/jdt/internal/core/ClassFile.java index a956b0d..2f68e53 100644 --- a/model/org/eclipse/jdt/internal/core/ClassFile.java +++ b/model/org/eclipse/jdt/internal/core/ClassFile.java
@@ -33,7 +33,7 @@ protected ClassFile(IPackageFragment parent, String name) { super(CLASS_FILE, parent, name); if (!Util.isClassFileName(name)) { - throw new IllegalArgumentException(Util.bind("element.invalidClassFileName"/*nonNLS*/)); + throw new IllegalArgumentException("class file name must end with .class"); } } /** @@ -42,7 +42,7 @@ public void codeComplete(int offset, ICodeCompletionRequestor requestor) throws JavaModelException { String source = getSource(); if (source != null) { - BasicCompilationUnit cu = new BasicCompilationUnit(getSource().toCharArray(), getElementName() + ".java"/*nonNLS*/); + BasicCompilationUnit cu = new BasicCompilationUnit(getSource().toCharArray(), getElementName() + ".java"); codeComplete(cu, cu, offset, requestor); } } @@ -56,7 +56,7 @@ contents = buffer.getCharacters(); String name = getElementName(); name = name.substring(0, name.length() - 6); // remove ".class" - name = name + ".java"/*nonNLS*/; + name = name + ".java"; BasicCompilationUnit cu = new BasicCompilationUnit(contents, name); return super.codeSelect(cu, offset, length); } else { @@ -141,7 +141,7 @@ zip = root.getJar(); String entryName = getParent().getElementName(); entryName = entryName.replace('.', '/'); - if (entryName.equals(""/*nonNLS*/)) { + if (entryName.equals("")) { entryName += getElementName(); } else { entryName += '/' + getElementName(); @@ -278,7 +278,7 @@ public WorkingCopy getWorkingCopy() { String name = getElementName(); name = name.substring(0, name.length() - 6); // remove ".class" - name = name + ".java"/*nonNLS*/; + name = name + ".java"; return new WorkingCopy((IPackageFragment) getParent(), name); } /**
diff --git a/model/org/eclipse/jdt/internal/core/ClassFileInfo.java b/model/org/eclipse/jdt/internal/core/ClassFileInfo.java index 2db5ba7..3421a37 100644 --- a/model/org/eclipse/jdt/internal/core/ClassFileInfo.java +++ b/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
@@ -73,7 +73,7 @@ for (int i = 0, typeCount = innerTypes.length; i < typeCount; i++) { IBinaryNestedType binaryType = innerTypes[i]; String innerQualifiedName = new String(binaryType.getName()); - IClassFile classFile= ((IPackageFragment)fClassFile.getParent()).getClassFile(new String(ClassFile.unqualifiedName(binaryType.getName())) + ".class"/*nonNLS*/); + IClassFile classFile= ((IPackageFragment)fClassFile.getParent()).getClassFile(new String(ClassFile.unqualifiedName(binaryType.getName())) + ".class"); IType innerType = new BinaryType(classFile, new String(ClassFile.simpleName(binaryType.getName()))); children.addElement(innerType); }
diff --git a/model/org/eclipse/jdt/internal/core/ClasspathEntry.java b/model/org/eclipse/jdt/internal/core/ClasspathEntry.java index 8ec95ad..3734bbc 100644 --- a/model/org/eclipse/jdt/internal/core/ClasspathEntry.java +++ b/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
@@ -170,38 +170,38 @@ buffer.append('['); switch (getEntryKind()) { case IClasspathEntry.CPE_LIBRARY: - buffer.append("CPE_LIBRARY"/*nonNLS*/); + buffer.append("CPE_LIBRARY"); break; case IClasspathEntry.CPE_PROJECT: - buffer.append("CPE_PROJECT"/*nonNLS*/); + buffer.append("CPE_PROJECT"); break; case IClasspathEntry.CPE_SOURCE: - buffer.append("CPE_SOURCE"/*nonNLS*/); + buffer.append("CPE_SOURCE"); break; case IClasspathEntry.CPE_VARIABLE: - buffer.append("CPE_VARIABLE"/*nonNLS*/); + buffer.append("CPE_VARIABLE"); break; } - buffer.append("]["/*nonNLS*/); + buffer.append("]["); switch (getContentKind()) { case IPackageFragmentRoot.K_BINARY: - buffer.append("K_BINARY"/*nonNLS*/); + buffer.append("K_BINARY"); break; case IPackageFragmentRoot.K_SOURCE: - buffer.append("K_SOURCE"/*nonNLS*/); + buffer.append("K_SOURCE"); break; case ClasspathEntry.K_OUTPUT: - buffer.append("K_OUTPUT"/*nonNLS*/); + buffer.append("K_OUTPUT"); break; } buffer.append(']'); if (getSourceAttachmentPath() != null){ - buffer.append("[sourcePath:"/*nonNLS*/); + buffer.append("[sourcePath:"); buffer.append(getSourceAttachmentPath()); buffer.append(']'); } if (getSourceAttachmentRootPath() != null){ - buffer.append("[rootPath:"/*nonNLS*/); + buffer.append("[rootPath:"); buffer.append(getSourceAttachmentRootPath()); buffer.append(']'); }
diff --git a/model/org/eclipse/jdt/internal/core/CommitWorkingCopyOperation.java b/model/org/eclipse/jdt/internal/core/CommitWorkingCopyOperation.java index 28d5127..7a138f6 100644 --- a/model/org/eclipse/jdt/internal/core/CommitWorkingCopyOperation.java +++ b/model/org/eclipse/jdt/internal/core/CommitWorkingCopyOperation.java
@@ -86,7 +86,7 @@ * of the original compilation unit fails */ protected void executeOperation() throws JavaModelException { - beginTask(Util.bind("workingCopy.commit"/*nonNLS*/), 2); + beginTask("Committing working copy...", 2); ICompilationUnit copy = getCompilationUnit(); ICompilationUnit original = (ICompilationUnit) copy.getOriginalElement();
diff --git a/model/org/eclipse/jdt/internal/core/CompilationUnit.java b/model/org/eclipse/jdt/internal/core/CompilationUnit.java index 8372504..4b972a5 100644 --- a/model/org/eclipse/jdt/internal/core/CompilationUnit.java +++ b/model/org/eclipse/jdt/internal/core/CompilationUnit.java
@@ -34,7 +34,7 @@ protected CompilationUnit(IPackageFragment parent, String name) { super(COMPILATION_UNIT, parent, name); if (!Util.isJavaFileName(name)) { - throw new IllegalArgumentException(Util.bind("convention.unit.notJavaName"/*nonNLS*/)); + throw new IllegalArgumentException("compilation unit name must end with .java"); } } /** @@ -77,7 +77,7 @@ */ public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException { if (container == null) { - throw new IllegalArgumentException(Util.bind("operation.nullContainer"/*nonNLS*/)); + throw new IllegalArgumentException("container cannot be null"); } IJavaElement[] elements = new IJavaElement[] {this}; IJavaElement[] containers = new IJavaElement[] {container}; @@ -120,10 +120,10 @@ if (!exists()) { //autogenerate this compilation unit IPackageFragment pkg = (IPackageFragment) getParent(); - String source = ""/*nonNLS*/; + String source = ""; if (pkg.getElementName().length() > 0) { //not the default package...add the package declaration - source = "package "/*nonNLS*/ + pkg.getElementName() + ";"/*nonNLS*/ + JavaModelManager.LINE_SEPARATOR; + source = "package " + pkg.getElementName() + ";" + JavaModelManager.LINE_SEPARATOR; } CreateCompilationUnitOperation op = new CreateCompilationUnitOperation(pkg, fName, source, force); runOperation(op, monitor); @@ -173,7 +173,7 @@ } else { // iterate through all the types inside the receiver and see if one of them can fit IType[] types = getTypes(); - String typeNodeName = nodeName.substring(0, nodeName.indexOf(".java"/*nonNLS*/)); + String typeNodeName = nodeName.substring(0, nodeName.indexOf(".java")); for (int i = 0, max = types.length; i < max; i++) { if (types[i].getElementName().equals(typeNodeName)) { return true; @@ -378,7 +378,7 @@ */ public String getSource() throws JavaModelException { IBuffer buffer = getBuffer(); - if (buffer == null) return ""/*nonNLS*/; + if (buffer == null) return ""; return buffer.getContents(); } /** @@ -470,7 +470,7 @@ */ public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException { if (container == null) { - throw new IllegalArgumentException(Util.bind("operation.nullContainer"/*nonNLS*/)); + throw new IllegalArgumentException("container cannot be null"); } IJavaElement[] elements= new IJavaElement[] {this}; IJavaElement[] containers= new IJavaElement[] {container}; @@ -540,7 +540,7 @@ */ public void rename(String name, boolean force, IProgressMonitor monitor) throws JavaModelException { if (name == null) { - throw new IllegalArgumentException(Util.bind("operation.nullName"/*nonNLS*/)); + throw new IllegalArgumentException("name cannot be null"); } IJavaElement[] elements= new IJavaElement[] {this}; IJavaElement[] dests= new IJavaElement[] {this.getParent()};
diff --git a/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java b/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java index acecc72..80e4bf4 100644 --- a/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java +++ b/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java
@@ -148,7 +148,7 @@ addReference(ReferenceInfo.REFTYPE_call, name); } else { - String name = "<"/*nonNLS*/ + new String(typeName) + ">/"/*nonNLS*/ + argCount; + String name = "<" + new String(typeName) + ">/" + argCount; addReference(ReferenceInfo.REFTYPE_call, name.toCharArray()); } } @@ -178,7 +178,7 @@ // tack on the '.*' if it is onDemand String importName; if (onDemand) { - importName= new String(name) + ".*"/*nonNLS*/; + importName= new String(name) + ".*"; } else { importName= new String(name); } @@ -239,7 +239,7 @@ addReference(ReferenceInfo.REFTYPE_call, name); } else { - String name = new String(methodName) + "/"/*nonNLS*/ + argCount; + String name = new String(methodName) + "/" + argCount; addReference(ReferenceInfo.REFTYPE_call, name.toCharArray()); } } @@ -559,13 +559,13 @@ if (fPackageName == null) { qualifiedName= nameString.toCharArray(); } else { - qualifiedName= (new String(fPackageName) + "."/*nonNLS*/ + nameString).toCharArray(); + qualifiedName= (new String(fPackageName) + "." + nameString).toCharArray(); } } else if (parentHandle.getElementType() == IJavaElement.TYPE) { handle = ((IType) parentHandle).getType(nameString); enclosingTypeName= ((SourceTypeElementInfo)parentInfo).getName(); - qualifiedName= (new String(((SourceTypeElementInfo)parentInfo).getQualifiedName()) + "."/*nonNLS*/ + nameString).toCharArray(); + qualifiedName= (new String(((SourceTypeElementInfo)parentInfo).getQualifiedName()) + "." + nameString).toCharArray(); } else { Assert.isTrue(false); // Should not happen
diff --git a/model/org/eclipse/jdt/internal/core/CopyElementsOperation.java b/model/org/eclipse/jdt/internal/core/CopyElementsOperation.java index 4858baf..25a2795 100644 --- a/model/org/eclipse/jdt/internal/core/CopyElementsOperation.java +++ b/model/org/eclipse/jdt/internal/core/CopyElementsOperation.java
@@ -68,7 +68,7 @@ * for progress monitoring. */ protected String getMainTaskName() { - return Util.bind("operation.copyElementProgress"/*nonNLS*/); + return "Copying elements..."; } /** * Returns the nested operation to use for processing this element @@ -83,7 +83,7 @@ return new CreateImportOperation(element.getElementName(), (ICompilationUnit) dest); case IJavaElement.TYPE : if (isRenamingMainType(element, dest)) { - return new RenameResourceElementsOperation(new IJavaElement[] {dest}, new IJavaElement[] {dest.getParent()}, new String[]{getNewNameFor(element) + ".java"/*nonNLS*/}, fForce); + return new RenameResourceElementsOperation(new IJavaElement[] {dest}, new IJavaElement[] {dest.getParent()}, new String[]{getNewNameFor(element) + ".java"}, fForce); } else { return new CreateTypeOperation(dest, getSourceFor(element) + JavaModelManager.LINE_SEPARATOR, fForce); }
diff --git a/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java b/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java index 3fe95cd..b868a99 100644 --- a/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java +++ b/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java
@@ -159,7 +159,7 @@ * @see MultiOperation */ protected String getMainTaskName() { - return Util.bind("operation.copyResourceProgress"/*nonNLS*/); + return "Copying resources..."; } /** * Sets the deltas to register the changes resulting from this operation @@ -223,9 +223,7 @@ // update new resource content try { - if (newContent != null){ - destFile.setContents(new ByteArrayInputStream(newContent.getBytes()), fForce, true, getSubProgressMonitor(1)); - } + destFile.setContents(new ByteArrayInputStream(newContent.getBytes()), fForce, true, getSubProgressMonitor(1)); } catch (CoreException e) { throw new JavaModelException(e); } @@ -342,7 +340,7 @@ } if (!newFrag.getElementName().equals(source.getElementName())) { // if package has been renamed, update the compilation units for (int i = 0; i < resources.length; i++) { - if (resources[i].getName().endsWith(".java"/*nonNLS*/)) { + if (resources[i].getName().endsWith(".java")) { // we only consider potential compilation units ICompilationUnit cu = newFrag.getCompilationUnit(resources[i].getName()); IDOMCompilationUnit domCU = fFactory.createCompilationUnit(cu.getSource(), cu.getElementName()); @@ -428,7 +426,7 @@ if (!seenPackageNode && !defaultPackage) { //the cu was in a default package...no package declaration //create the new package declaration as the first child of the cu - IDOMPackage pkg = fFactory.createPackage("package "/*nonNLS*/ + pkgName + ";"/*nonNLS*/ + JavaModelManager.LINE_SEPARATOR); + IDOMPackage pkg = fFactory.createPackage("package " + pkgName + ";" + JavaModelManager.LINE_SEPARATOR); domCU.getFirstChild().insertSibling(pkg); } }
diff --git a/model/org/eclipse/jdt/internal/core/CreateCompilationUnitOperation.java b/model/org/eclipse/jdt/internal/core/CreateCompilationUnitOperation.java index 2a8ce5f..22db53e 100644 --- a/model/org/eclipse/jdt/internal/core/CreateCompilationUnitOperation.java +++ b/model/org/eclipse/jdt/internal/core/CreateCompilationUnitOperation.java
@@ -54,7 +54,7 @@ * @exception JavaModelException if unable to create the compilation unit. */ protected void executeOperation() throws JavaModelException { - beginTask(Util.bind("operation.createUnitProgress"/*nonNLS*/), 2); + beginTask("Creating a compilation unit...", 2); JavaElementDelta delta = newJavaElementDelta(); ICompilationUnit unit = getCompilationUnit(); IPackageFragment pkg = (IPackageFragment) getParentElement();
diff --git a/model/org/eclipse/jdt/internal/core/CreateFieldOperation.java b/model/org/eclipse/jdt/internal/core/CreateFieldOperation.java index 79ab766..7515b81 100644 --- a/model/org/eclipse/jdt/internal/core/CreateFieldOperation.java +++ b/model/org/eclipse/jdt/internal/core/CreateFieldOperation.java
@@ -55,7 +55,7 @@ * @see CreateElementInCUOperation#getMainTaskName */ public String getMainTaskName(){ - return Util.bind("operation.createFieldProgress"/*nonNLS*/); + return "Creating a field..."; } /** * By default the new field is positioned after the last existing field
diff --git a/model/org/eclipse/jdt/internal/core/CreateImportOperation.java b/model/org/eclipse/jdt/internal/core/CreateImportOperation.java index f40b1fb..bb9f7ca 100644 --- a/model/org/eclipse/jdt/internal/core/CreateImportOperation.java +++ b/model/org/eclipse/jdt/internal/core/CreateImportOperation.java
@@ -72,7 +72,7 @@ * @see CreateElementInCUOperation#getMainTaskName */ public String getMainTaskName(){ - return Util.bind("operation.createImportsProgress"/*nonNLS*/); + return "Creating imports..."; } /** * Sets the correct position for the new import:<ul>
diff --git a/model/org/eclipse/jdt/internal/core/CreateInitializerOperation.java b/model/org/eclipse/jdt/internal/core/CreateInitializerOperation.java index 436ee5a..b060f17 100644 --- a/model/org/eclipse/jdt/internal/core/CreateInitializerOperation.java +++ b/model/org/eclipse/jdt/internal/core/CreateInitializerOperation.java
@@ -78,7 +78,7 @@ * @see CreateElementInCUOperation#getMainTaskName */ public String getMainTaskName(){ - return Util.bind("operation.createInitializerProgress"/*nonNLS*/); + return "Creating an initializer..."; } /** * By default the new initializer is positioned after the last existing initializer
diff --git a/model/org/eclipse/jdt/internal/core/CreateMethodOperation.java b/model/org/eclipse/jdt/internal/core/CreateMethodOperation.java index d99a852..f9b152a 100644 --- a/model/org/eclipse/jdt/internal/core/CreateMethodOperation.java +++ b/model/org/eclipse/jdt/internal/core/CreateMethodOperation.java
@@ -79,7 +79,7 @@ * @see CreateElementInCUOperation#getMainTaskName */ public String getMainTaskName(){ - return Util.bind("operation.createMethodProgress"/*nonNLS*/); + return "Creating a method..."; } /** * @see CreateTypeMemberOperation#verifyNameCollision
diff --git a/model/org/eclipse/jdt/internal/core/CreatePackageDeclarationOperation.java b/model/org/eclipse/jdt/internal/core/CreatePackageDeclarationOperation.java index 14fd966..5e71dc7 100644 --- a/model/org/eclipse/jdt/internal/core/CreatePackageDeclarationOperation.java +++ b/model/org/eclipse/jdt/internal/core/CreatePackageDeclarationOperation.java
@@ -72,7 +72,7 @@ * @see CreateElementInCUOperation#getMainTaskName */ public String getMainTaskName(){ - return Util.bind("operation.createPackageProgress"/*nonNLS*/); + return "Creating a package declaration..."; } /** * Sets the correct position for new package declaration:<ul>
diff --git a/model/org/eclipse/jdt/internal/core/CreatePackageFragmentOperation.java b/model/org/eclipse/jdt/internal/core/CreatePackageFragmentOperation.java index 8e9c69e..f0bf636 100644 --- a/model/org/eclipse/jdt/internal/core/CreatePackageFragmentOperation.java +++ b/model/org/eclipse/jdt/internal/core/CreatePackageFragmentOperation.java
@@ -54,9 +54,9 @@ JavaElementDelta delta = newJavaElementDelta(); IPackageFragmentRoot root = (IPackageFragmentRoot) getParentElement(); String[] names = Signature.getSimpleNames(fName); - beginTask(Util.bind("operation.createPackageFragmentProgress"/*nonNLS*/), names.length); + beginTask("Creating package fragment(s)...", names.length); IContainer parentFolder = (IContainer) root.getUnderlyingResource(); - String sideEffectPackageName = ""/*nonNLS*/; + String sideEffectPackageName = ""; Vector resultElements = new Vector(names.length); int i; for (i = 0; i < names.length; i++) {
diff --git a/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java b/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java index 58e4d3c..abd5d79 100644 --- a/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java +++ b/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java
@@ -64,11 +64,11 @@ protected IDOMNode generateSyntaxIncorrectDOM() throws JavaModelException { //create some dummy source to generate a dom node StringBuffer buff = new StringBuffer(); - buff.append(JavaModelManager.LINE_SEPARATOR + " public class A {"/*nonNLS*/ + JavaModelManager.LINE_SEPARATOR); + buff.append(JavaModelManager.LINE_SEPARATOR + " public class A {" + JavaModelManager.LINE_SEPARATOR); buff.append(fSource); buff.append(JavaModelManager.LINE_SEPARATOR).append('}'); - IDOMCompilationUnit domCU = (new DOMFactory()).createCompilationUnit(buff.toString(), "A.java"/*nonNLS*/); - IDOMNode node = (IDOMNode) domCU.getChild("A"/*nonNLS*/).getChildren().nextElement(); + IDOMCompilationUnit domCU = (new DOMFactory()).createCompilationUnit(buff.toString(), "A.java"); + IDOMNode node = (IDOMNode) domCU.getChild("A").getChildren().nextElement(); if (node != null) { node.remove(); }
diff --git a/model/org/eclipse/jdt/internal/core/CreateTypeOperation.java b/model/org/eclipse/jdt/internal/core/CreateTypeOperation.java index 9a1a08d..9d20048 100644 --- a/model/org/eclipse/jdt/internal/core/CreateTypeOperation.java +++ b/model/org/eclipse/jdt/internal/core/CreateTypeOperation.java
@@ -58,7 +58,7 @@ * @see CreateElementInCUOperation#getMainTaskName */ public String getMainTaskName(){ - return Util.bind("operation.createTypeProgress"/*nonNLS*/); + return "Creating a type..."; } /** * Returns the <code>IType</code> the member is to be created in.
diff --git a/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java b/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java index 1f1a2e7..cce6e15 100644 --- a/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java +++ b/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java
@@ -60,7 +60,7 @@ * @see MultiOperation */ protected String getMainTaskName() { - return Util.bind("operation.deleteElementProgress"/*nonNLS*/); + return "Deleting elements..."; } /** * Groups the elements to be processed by their compilation unit. @@ -112,7 +112,7 @@ if (e.exists()) { IDOMNode node = ((JavaElement) e).findNode(cuDOM); // TBD - Assert.isTrue(node != null, Util.bind("element.cannotLocate"/*nonNLS*/, e.getElementName(), cuDOM.getName())); + Assert.isTrue(node != null, "Failed to locate " + e.getElementName() + " in " + cuDOM.getName()); node.remove(); delta.removed(e); if (e.getElementType() == IJavaElement.IMPORT_DECLARATION) {
diff --git a/model/org/eclipse/jdt/internal/core/DeleteResourceElementsOperation.java b/model/org/eclipse/jdt/internal/core/DeleteResourceElementsOperation.java index 01cf6db..099fee6 100644 --- a/model/org/eclipse/jdt/internal/core/DeleteResourceElementsOperation.java +++ b/model/org/eclipse/jdt/internal/core/DeleteResourceElementsOperation.java
@@ -61,25 +61,15 @@ } deleteResources(actualNonJavaResources, fForce); - // delete remaining files in this package (.class file in the case where Proj=src=bin) - IResource[] remaingFiles; + // remove the folder if it is empty + IResource[] members; try { - remaingFiles = ((IFolder) res).members(); + members = ((IFolder) res).members(); } catch (CoreException ce) { throw new JavaModelException(ce); } - boolean isEmpty = true; - for (int i = 0, length = remaingFiles.length; i < length; i++) { - IResource file = remaingFiles[i]; - if (file instanceof IFile) { - this.deleteResource(file, true); - } else { - isEmpty = false; - } - } - if (isEmpty) { - // delete recursively empty folders - deleteEmptyPackageFragment(frag, false); + if (members.length == 0) { + deleteEmptyPackageFragment(frag, fForce); } } } @@ -87,7 +77,7 @@ * @see MultiOperation */ protected String getMainTaskName() { - return Util.bind("operation.deleteResourceProgress"/*nonNLS*/); + return "Deleting resources..."; } /** * @see MultiOperation. This method delegate to <code>deleteResource</code> or
diff --git a/model/org/eclipse/jdt/internal/core/DeltaProcessor.java b/model/org/eclipse/jdt/internal/core/DeltaProcessor.java index 5b36f6f..71af00d 100644 --- a/model/org/eclipse/jdt/internal/core/DeltaProcessor.java +++ b/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
@@ -314,7 +314,7 @@ if (resource == null) return null; String extension = resource.getFileExtension(); extension = extension == null ? null : extension.toLowerCase(); - if ("jar"/*nonNLS*/.equals(extension) || "zip"/*nonNLS*/.equals(extension)) { + if ("jar".equals(extension) || "zip".equals(extension)) { IJavaProject[] projects = null; try { projects = JavaModelManager.getJavaModel(resource.getWorkspace()).getJavaProjects();
diff --git a/model/org/eclipse/jdt/internal/core/FailedReconciliationException.java b/model/org/eclipse/jdt/internal/core/FailedReconciliationException.java index 61eaed2..6f799b4 100644 --- a/model/org/eclipse/jdt/internal/core/FailedReconciliationException.java +++ b/model/org/eclipse/jdt/internal/core/FailedReconciliationException.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public class FailedReconciliationException extends RuntimeException { /**
diff --git a/model/org/eclipse/jdt/internal/core/HandleFactory.java b/model/org/eclipse/jdt/internal/core/HandleFactory.java index 5c81de4..c2e111a 100644 --- a/model/org/eclipse/jdt/internal/core/HandleFactory.java +++ b/model/org/eclipse/jdt/internal/core/HandleFactory.java
@@ -96,7 +96,7 @@ this.packageHandles.put(packageName, pkgFragment); } String simpleName= resourcePath.substring(lastSlash + 1); - if (Util.isJavaFileName(simpleName)) { + if (simpleName.endsWith(".java")) { ICompilationUnit unit= pkgFragment.getCompilationUnit(simpleName); return (Openable) unit; } else {
diff --git a/model/org/eclipse/jdt/internal/core/IJavaReconciler.java b/model/org/eclipse/jdt/internal/core/IJavaReconciler.java index 5d5778e..d407ea7 100644 --- a/model/org/eclipse/jdt/internal/core/IJavaReconciler.java +++ b/model/org/eclipse/jdt/internal/core/IJavaReconciler.java
@@ -1,22 +1,5 @@ package org.eclipse.jdt.internal.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * An <code>IJavaReconciler</code> is used to incrementally update - * the structure of a working copy compilation unit as edits take - * place in its buffer. As each contiguous edit is performed on the - * buffer, calls are made to the reconciler which will update the - * internal structure of the working copy (i.e. add/remove elements), - * and report structural changes as <code>IJavaElementDelta</code>s. - * <p> - * Deltas are distributed via the <code>IElementChangedListener</code> - * mechanism. Interested listeners must register with the - * <code>IJavaModelManager</code>. - */ public interface IJavaReconciler { /** * Reconciles a deletion of contiguous text.
diff --git a/model/org/eclipse/jdt/internal/core/IPathRequestor.java b/model/org/eclipse/jdt/internal/core/IPathRequestor.java index 7f2a20e..90e7c7a 100644 --- a/model/org/eclipse/jdt/internal/core/IPathRequestor.java +++ b/model/org/eclipse/jdt/internal/core/IPathRequestor.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public interface IPathRequestor { void acceptPath(String path);
diff --git a/model/org/eclipse/jdt/internal/core/ImportContainer.java b/model/org/eclipse/jdt/internal/core/ImportContainer.java index 99db352..2aba257 100644 --- a/model/org/eclipse/jdt/internal/core/ImportContainer.java +++ b/model/org/eclipse/jdt/internal/core/ImportContainer.java
@@ -13,7 +13,7 @@ */ public class ImportContainer extends SourceRefElement implements IImportContainer { protected ImportContainer(ICompilationUnit parent) { - super(IMPORT_CONTAINER, parent, ""/*nonNLS*/); + super(IMPORT_CONTAINER, parent, ""); } /** * @see JavaElement#getHandleMemento() @@ -25,8 +25,7 @@ * @see JavaElement#getHandleMemento() */ protected char getHandleMementoDelimiter() { - Assert.isTrue(false, Util.bind("assert.shouldNotImplement"/*nonNLS*/)); - return 0; + throw new Error("should not be called"); } /** * @see IImportContainer @@ -65,7 +64,7 @@ if (info == null || !(info instanceof JavaElementInfo)) return; IJavaElement[] children = ((JavaElementInfo)info).getChildren(); for (int i = 0; i < children.length; i++) { - if (i > 0) buffer.append("\n"/*nonNLS*/); + if (i > 0) buffer.append("\n"); ((JavaElement)children[i]).toString(tab, buffer); } }
diff --git a/model/org/eclipse/jdt/internal/core/ImportDeclaration.java b/model/org/eclipse/jdt/internal/core/ImportDeclaration.java index bd6f120..250f049 100644 --- a/model/org/eclipse/jdt/internal/core/ImportDeclaration.java +++ b/model/org/eclipse/jdt/internal/core/ImportDeclaration.java
@@ -39,7 +39,7 @@ * Returns true if the import is on-demand (ends with ".*") */ public boolean isOnDemand() { - return fName.endsWith(".*"/*nonNLS*/); + return fName.endsWith(".*"); } /** */ @@ -51,10 +51,10 @@ * @private Debugging purposes */ protected void toStringInfo(int tab, StringBuffer buffer, Object info) { - buffer.append("import "/*nonNLS*/); + buffer.append("import "); buffer.append(getElementName()); if (info == null) { - buffer.append(" (not open)"/*nonNLS*/); + buffer.append(" (not open)"); } } }
diff --git a/model/org/eclipse/jdt/internal/core/IncrementalDeterministicRequestor.java b/model/org/eclipse/jdt/internal/core/IncrementalDeterministicRequestor.java new file mode 100644 index 0000000..7079c09 --- /dev/null +++ b/model/org/eclipse/jdt/internal/core/IncrementalDeterministicRequestor.java
@@ -0,0 +1,268 @@ +package org.eclipse.jdt.internal.core; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ +import org.eclipse.core.resources.*; + +import org.eclipse.jdt.internal.compiler.*; +import org.eclipse.jdt.core.*; +import org.eclipse.jdt.internal.core.util.ReferenceInfoAdapter; + +import java.util.*; + +/** + * Handles the results of a source element parse, and with + * the help of the <code>Reconciler</code>, throws element + * changed deltas. + */ +public class IncrementalDeterministicRequestor extends ReferenceInfoAdapter implements ISourceElementRequestor { + + + /** + * The expected elements + */ + protected IJavaElement[] fElements; + + /** + * The next element expected + */ + protected IJavaElement fNextElement; + + /** + * The index of the next expected element + */ + protected int fNextIndex= 0; + + +/** + * Creates a requestor + */ +public IncrementalDeterministicRequestor(IJavaElement[] expectations) { + fElements= expectations; + next(); +} +/** + * @see ISourceElementRequestor + */ +public void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand) { + if (fNextElement.getElementType() == IJavaElement.IMPORT_DECLARATION) { + if (isIdentical((IImportDeclaration) fNextElement, name, onDemand)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void acceptInitializer(int modifiers, int declarationSourceStart, int declarationSourceEnd) { + if (fNextElement.getElementType() == IJavaElement.IMPORT_DECLARATION) { + next(); + return; + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void acceptLineSeparatorPositions(int[] positions) {} +/** + * @see ISourceElementRequestor + */ +public void acceptPackage(int declarationStart, int declarationEnd, char[] name) { + if (fNextElement.getElementType() == IJavaElement.PACKAGE_DECLARATION) { + if (isIdentical((IPackageDeclaration) fNextElement, name)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void acceptProblem(IProblem problem) {} +/** + * Advances to the next expected element + */ +protected void advance() { + if (fNextIndex < fElements.length) { + fNextElement= fElements[fNextIndex]; + fNextIndex++; + } else { + fNextElement= null; + } +} +/** + * @see ISourceElementRequestor + */ +public void enterClass(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[] superclass, char[][] superinterfaces) { + if (fNextElement.getElementType() == IJavaElement.TYPE) { + if (isIdentical((IType) fNextElement, name)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void enterCompilationUnit() { + if (fNextElement.getElementType() == IJavaElement.COMPILATION_UNIT) { + next(); + return; + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void enterConstructor(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) { + if (fNextElement.getElementType() == IJavaElement.METHOD) { + if (isIdentical((IMethod)fNextElement, name, parameterTypes)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameSourceStart, int nameSourceEnd) { + if (fNextElement.getElementType() == IJavaElement.FIELD) { + if (isIdentical((IField)fNextElement, name)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void enterInterface(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] superinterfaces) { + if (fNextElement.getElementType() == IJavaElement.TYPE) { + if (isIdentical((IType) fNextElement, name)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) { + if (fNextElement.getElementType() == IJavaElement.METHOD) { + if (isIdentical((IMethod)fNextElement, name, parameterTypes)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * Answers true if the two arguments are equal. If either are null answers false, if + * both are null answers true; + */ +protected static final boolean equals(String string, char[] chars) { + if (string == null ^ chars == null) + return false; + if (string == null) + return true; + int length = chars.length; + if (string.length() != length) + return false; + while(length-- != 0) { + if (string.charAt(length) != chars[length]) + return false; + } + return true; +} +/** + * @see ISourceElementRequestor + */ +public void exitClass(int declarationEnd) { +} +/** + * @see ISourceElementRequestor + */ +public void exitCompilationUnit(int declarationEnd) {} +/** + * @see ISourceElementRequestor + */ +public void exitConstructor(int declarationEnd) {} +/** + * @see ISourceElementRequestor + */ +public void exitField(int declarationEnd) {} +/** + * @see ISourceElementRequestor + */ +public void exitInterface(int declarationEnd) { +} +/** + * @see ISourceElementRequestor + */ +public void exitMethod(int declarationEnd) {} +protected boolean isIdentical(IField field, char[] name) { + if (!equals(field.getElementName(), name)) + return false; + return true; +} +protected boolean isIdentical(IImportDeclaration anImport, char[] name, boolean isOnDemand) { + String importString = new String(name); + if (isOnDemand) + importString += ".*"; + if (!anImport.getElementName().equals(importString)) + return false; + return true; +} +protected boolean isIdentical(IMethod method, char[] name, char[][] parameterTypes) { + if (!equals(method.getElementName(), name)) + return false; + String[] parameters = method.getParameterTypes(); + if (parameters == null || parameters.length == 0) { + if (parameterTypes == null || parameterTypes.length == 0) { + return true; + } else { + return false; + } + } + + if (parameters.length != parameterTypes.length) + return false; + for(int i = 0, length = parameters.length; i < length; i++) { + if (parameters[i] == null ^ parameterTypes[i] == null) + return false; + if (parameters[i] == null) + continue; + if (!parameters[i].equals(Signature.createTypeSignature(parameterTypes[i], false))) + return false; + } + return true; +} +protected boolean isIdentical(IPackageDeclaration aPackage, char[] name) { + if (!equals(aPackage.getElementName(), name)) + return false; + return true; +} +protected boolean isIdentical(IType type, char[] name) { + if (!equals(type.getElementName(), name)) + return false; + return true; +} +/** + * Advances the next element expected. + */ +protected void next() { + advance(); + if (fNextElement.getElementType() == IJavaElement.IMPORT_CONTAINER) + next(); +} +}
diff --git a/model/org/eclipse/jdt/internal/core/IncrementalReconciler.java b/model/org/eclipse/jdt/internal/core/IncrementalReconciler.java new file mode 100644 index 0000000..23952e8 --- /dev/null +++ b/model/org/eclipse/jdt/internal/core/IncrementalReconciler.java
@@ -0,0 +1,353 @@ +package org.eclipse.jdt.internal.core; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ +import org.eclipse.core.resources.*; + +import org.eclipse.jdt.internal.compiler.*; +import org.eclipse.jdt.internal.compiler.env.ISourceType; +import org.eclipse.jdt.core.*; + +import java.util.*; + + +import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; + +/** + * The <code>IncrementalReconciler</code> notifies the + * JavaModel of changes made the compilation unit that + * this reconciler watches. + * + * <p>The <code>IncrementalReconciler</code> attempts to + * improve the performance and functionality of the + * <code>Reconciler</code> by only reconciling elements + * which are effected by a text edit. + * + * <p>The implementation is not thread safe. + * + * <p>The API expects all text edits to have already occured + * in the buffer of the <code>ICompilationUnit</code> + * which this reconciler is using. + * + * @see Reconciler + */ +public class IncrementalReconciler implements IJavaReconciler { + /** + * The current compilation unit + */ + protected ICompilationUnit fCompilationUnit = null; +/** + * Create a reconciler on a compilation unit + * + * @exception IllegalArgumentException if the compilation unit is not + * a working copy. + */ +public IncrementalReconciler(ICompilationUnit cu) { + fCompilationUnit = cu; + if (!cu.isWorkingCopy()) { + throw new IllegalArgumentException("must create reconciler on a working copy"); + } +} +/** + * Does a full reconcile. + */ +protected void doFullReconcile() { + try { + fCompilationUnit.reconcile(); + } catch (JavaModelException e) { + } +} +/** + * Answers the <code>IJavaElement</code> closest too and after the given + * position in the given parent, or <code>null</code> if there is no element + * after the given position. + */ +protected IJavaElement getElementAfter(int position, IJavaElement parent) { + IJavaElement[] children = null; + try { + children = ((IParent) parent).getChildren(); + } catch (JavaModelException npe) { + return null; + } + if (children == null) + return null; + int length = children.length; + if (length > 0) { + for(int i = 0; i < length ; i++) { + IJavaElement child = children[i]; + if (getSourceOffset(child) + getSourceLength(child) - 1 > position) + return child; + } + } + return null; +} +/** + * Answers the <code>IJavaElement</code> following the + * given element, or <code>null</code> if there is no element + * following the given element. + */ +protected IJavaElement getElementAfter(IJavaElement element) { + IJavaElement[] children = null; + try { + children = ((IParent)element.getParent()).getChildren(); + } catch (JavaModelException npe) { + return null; + } + if (children == null) + return null; + int length = children.length; + if (length > 0) { + for(int i = 0; i < length ; i++) { + IJavaElement child = children[i]; + if (child.equals(element) && i < length - 1) + return children[i + 1]; + } + } + return null; +} +/** + * Answers the <code>IJavaElement</code> closest too and before the given + * position in the given parent, or <code>null</code> if there is no element + * before the given position. + */ +protected IJavaElement getElementBefore(int position, IJavaElement parent) { + IJavaElement[] children = null; + try { + children = ((IParent) parent).getChildren(); + } catch (JavaModelException npe) { + return null; + } + if (children == null) + return null; + int length = children.length; + if (length > 0) { + for(int i = length -1; i >= 0; i--) { + IJavaElement child = children[i]; + if (getSourceOffset(child) + getSourceLength(child) - 1 < position) + return child; + } + } + return null; +} +/** + * + */ +protected IJavaElement[] getElementsBetween(IJavaElement first, IJavaElement last) { + if (first.equals(last)) { + return new IJavaElement[] {first}; + } + + IJavaElement[] children = null; + IParent parent= (IParent)first.getParent(); + Vector elements= new Vector(); + + try { + children = ((IParent) parent).getChildren(); + } catch (JavaModelException npe) { + return null; + } + if (children == null) + return null; + + boolean inside= false; + for(int i = 0; i < children.length; i++) { + IJavaElement child = children[i]; + if (inside) { + elements.addElement(child); + if (child.equals(last)) { + inside= false; + break; + } + } else { + if (child.equals(first)){ + inside= true; + elements.addElement(child); + } + } + } + + IJavaElement[] array = new IJavaElement[elements.size()]; + elements.copyInto(array); + return array; +} +/** + * Answers the closest enclosing type of the element + */ +protected IType getEnclosingType(IJavaElement element) { + IJavaElement parent = element.getParent(); + while(parent != null && !(parent.getElementType() == IJavaElement.TYPE)) + parent = parent.getParent(); + return (IType)parent; +} +/** + * Returns the source length of the element or + * 0 if the element is not present or not a source element. + */ +protected int getSourceLength(IJavaElement element) { + if (element instanceof SourceRefElement) { + try { + return ((SourceRefElement) element).getSourceRange().getLength(); + } catch (JavaModelException npe) {} + } + return 0; +} +/** + * Returns the source offset of the element or + * -1 if the element is not present or not a source element. + */ +protected int getSourceOffset(IJavaElement element) { + if (element instanceof SourceRefElement) { + try { + return ((SourceRefElement) element).getSourceRange().getOffset(); + } catch (JavaModelException npe) {} + } + return -1; +} +protected boolean isWhitespace(int position, int length) { + int end = position + length; + try { + IBuffer buffer = fCompilationUnit.getBuffer(); + for (int i = position; i < end; i++) { + if (!Character.isWhitespace(buffer.getChar(i))) + return false; + } + return true; + } catch (JavaModelException npe) { + return false; + } +} +protected void reconcile(SourceType type, IncrementalDeterministicRequestor requestor, int start, int end) { + SourceElementParser parser = new SourceElementParser(requestor, new DefaultProblemFactory()); + try { + if (type != null) { + try { + parser.parseTypeMemberDeclarations((ISourceType) type.getElementInfo(), (CompilationUnit) fCompilationUnit, start, end, false); + } catch (JavaModelException npe) { + doFullReconcile(); + return; + } + } else { + parser.parseCompilationUnit((CompilationUnit) fCompilationUnit, start, end, false); + } + } catch (FailedReconciliationException fre) { + doFullReconcile(); + return; + } + System.out.println("Did incremental"); +} +/** + * @see IReconciler + */ +public void textDeleted(int position, int length) { + doFullReconcile(); + if (true) { + return; + } + try { + if (isWhitespace(position, length)) { + System.out.println("Whitespace"); + return; + } + + int endPosition = position + length; + IJavaElement first = fCompilationUnit.getElementAt(position); + IJavaElement last = fCompilationUnit.getElementAt(endPosition); + + if (first == last) { + if (first == null) { + first = fCompilationUnit; + last = fCompilationUnit; + } + } else { + doFullReconcile(); + return; + } + + if (first instanceof IParent) { + first = getElementBefore(position, first); + last = getElementAfter(endPosition, last); + } + + if (first != last) { + doFullReconcile(); + return; + } + + int offset = getSourceOffset(first); + int end = offset + getSourceLength(first) - length; + + if (end <= offset) { + doFullReconcile(); + return; + } + + SourceType type = (SourceType) getEnclosingType(first); + + IncrementalDeterministicRequestor requestor = + new IncrementalDeterministicRequestor(new IJavaElement[] {first}); + reconcile(type, requestor, offset, end); + } catch (JavaModelException e) { + return; + } +} +/** + * @see IReconciler + */ +public void textInserted(int position, int length) { + doFullReconcile(); + if (true) { + return; + } + try { + if (isWhitespace(position, length)) { + System.out.println("Whitespace"); + return; + } + + IJavaElement element= fCompilationUnit.getElementAt(position); + IJavaElement first= null, last= null; + + if (element == null) + element = fCompilationUnit; + + if (element instanceof IParent) { + first= getElementBefore(position, element); + last= getElementAfter(position, element); + } else { + if (position == getSourceOffset(element)) { + first = getElementBefore(position, element.getParent()); + last = element; + } else { + first = element; + last = getElementAfter(element); + } + } + + if (first == null || last == null) { + doFullReconcile(); + return; + } + + int offset= getSourceOffset(first); + int end= offset + getSourceLength(last) + length - 1; + + if (end <= offset) { + doFullReconcile(); + return; + } + + SourceType type = (SourceType)getEnclosingType(first); + // parse the new text, hoping for the same elements + IncrementalDeterministicRequestor requestor = + new IncrementalDeterministicRequestor(new IJavaElement[] {first, last}); + + reconcile(type, requestor, offset, end); + + } catch (JavaModelException e) { + return; + } + +} +}
diff --git a/model/org/eclipse/jdt/internal/core/IncrementalReconcilerRequestor.java b/model/org/eclipse/jdt/internal/core/IncrementalReconcilerRequestor.java new file mode 100644 index 0000000..3738ef1 --- /dev/null +++ b/model/org/eclipse/jdt/internal/core/IncrementalReconcilerRequestor.java
@@ -0,0 +1,388 @@ +package org.eclipse.jdt.internal.core; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ +import org.eclipse.core.resources.*; + +import org.eclipse.jdt.internal.compiler.*; +import org.eclipse.jdt.core.*; +import org.eclipse.jdt.internal.core.util.ReferenceInfoAdapter; + +import java.util.*; + +/** + * Handles the results of a source element parse, and with + * the help of the <code>Reconciler</code>, throws element + * changed deltas. + */ +public class IncrementalReconcilerRequestor extends ReferenceInfoAdapter implements ISourceElementRequestor { + /** + * The compilation unit the reconciler is working on + */ + protected ICompilationUnit fCompilationUnit; + + + /** + * The last expected element + */ + protected IJavaElement fLastElement; + + + /** + * As the compilation unit is traversed, this stack + * maintains lists of children and positions in the list + */ + protected Stack fStack; + + /** + * The next element expected from the parser. + */ + protected IJavaElement fNextElement; + + /** + * A helper class which stores children and array position information + */ + class TraversalInfo { + protected IJavaElement[] fArray; + protected int fLength; + protected int fPosition; + protected boolean fIsType; + protected String fParentName; + protected int fInitializerCount; + + public TraversalInfo(IJavaElement[] array, String parentName, boolean isType) { + fArray = array; + fParentName = parentName; + fIsType = isType; + fLength = (fArray != null) ? fArray.length : 0; + fPosition = 0; + fInitializerCount = 0; + } + public IJavaElement next() { + if (fPosition < fLength) + return fArray[fPosition++]; + return null; + } + public String getParentName() { + return fParentName; + } + public int getNextInitializer() { + return ++fInitializerCount; + } + public int getInitializerCount() { + return fInitializerCount; + } + public boolean isType() { + return fIsType; + } + } +/** + * Creates a requestor + */ +public IncrementalReconcilerRequestor(ICompilationUnit cu, IJavaElement first, IJavaElement last) { + fCompilationUnit = cu; + fStack = new Stack(); + initializeStack(); + advanceTo(first); + fLastElement = last; +} +/** + * @see ISourceElementRequestor + */ +public void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand) { + if (fNextElement.getElementType() == IJavaElement.IMPORT_DECLARATION) { + if (isIdentical((IImportDeclaration) fNextElement, name, onDemand)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void acceptInitializer(int modifiers, int declarationSourceStart, int declarationSourceEnd) { + if (fNextElement.getElementType() == IJavaElement.IMPORT_DECLARATION) { + next(); + return; + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void acceptLineSeparatorPositions(int[] positions) {} +/** + * @see ISourceElementRequestor + */ +public void acceptPackage(int declarationStart, int declarationEnd, char[] name) { + if (fNextElement.getElementType() == IJavaElement.PACKAGE_DECLARATION) { + if (isIdentical((IPackageDeclaration) fNextElement, name)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void acceptProblem(IProblem problem) {} +/** + * Advances to the next expected element + */ +protected void advance() { + if (!fStack.empty()) { + TraversalInfo info = (TraversalInfo) fStack.peek(); + fNextElement = info.next(); + if (fNextElement == null) { + fStack.pop(); + next(); + return; + } else { + if (fNextElement instanceof IParent) + push(fNextElement); + } + } else { + fNextElement = null; + } +} +/** + * Advances to the given element. + */ +protected void advanceTo(IJavaElement element) { + while(fNextElement != element) + advance(); +} +/** + * @see ISourceElementRequestor + */ +public void enterClass(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[] superclass, char[][] superinterfaces) { + if (fNextElement.getElementType() == IJavaElement.TYPE) { + if (isIdentical((IType) fNextElement, name)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void enterCompilationUnit() { + if (fNextElement.getElementType() == IJavaElement.COMPILATION_UNIT) { + next(); + return; + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void enterConstructor(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) { + if (fNextElement.getElementType() == IJavaElement.METHOD) { + if (isIdentical((IMethod)fNextElement, name, parameterTypes)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameSourceStart, int nameSourceEnd) { + if (fNextElement.getElementType() == IJavaElement.FIELD) { + if (isIdentical((IField)fNextElement, name)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void enterInterface(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] superinterfaces) { + if (fNextElement.getElementType() == IJavaElement.TYPE) { + if (isIdentical((IType) fNextElement, name)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * @see ISourceElementRequestor + */ +public void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) { + if (fNextElement.getElementType() == IJavaElement.METHOD) { + if (isIdentical((IMethod)fNextElement, name, parameterTypes)) { + next(); + return; + } + } + throw new FailedReconciliationException(); +} +/** + * Answers true if the two arguments are equal. If either are null answers false, if + * both are null answers true; + */ +protected static final boolean equals(String string, char[] chars) { + if (string == null ^ chars == null) + return false; + if (string == null) + return true; + int length = chars.length; + if (string.length() != length) + return false; + while(length-- != 0) { + if (string.charAt(length) != chars[length]) + return false; + } + return true; +} +/** + * @see ISourceElementRequestor + */ +public void exitClass(int declarationEnd) { +} +/** + * @see ISourceElementRequestor + */ +public void exitCompilationUnit(int declarationEnd) {} +/** + * @see ISourceElementRequestor + */ +public void exitConstructor(int declarationEnd) {} +/** + * @see ISourceElementRequestor + */ +public void exitField(int declarationEnd) {} +/** + * @see ISourceElementRequestor + */ +public void exitInterface(int declarationEnd) { +} +/** + * @see ISourceElementRequestor + */ +public void exitMethod(int declarationEnd) {} +/** + * Returns the first type encountered on the top of the stack + */ +protected IType getCurrentType() { + IType type = null; + for(int i = 0, length = fStack.size(); i < length; i++) { + TraversalInfo info = (TraversalInfo)fStack.elementAt(i); + if (info.isType()) { + if (type == null) { + type = fCompilationUnit.getType(info.getParentName()); + } else { + type = type.getType(info.getParentName()); + } + } + } + return type; +} +/** + * Answers the next initializer number for the current type + */ +protected int getNextInitializerNumber() { + // reverse traversal intentional + for (int i = fStack.size() - 1; i >= 0; i--) { + } + return -1; +} +/** + * Initializes the stack to contain <code>fCompilationUnit</code> + */ +protected void initializeStack() { + IJavaElement[] elements = { fCompilationUnit }; + fStack.push(new TraversalInfo(elements, null, false)); + next(); +} +protected boolean isIdentical(IField field, char[] name) { + if (!equals(field.getElementName(), name)) + return false; + return true; +} +protected boolean isIdentical(IImportDeclaration anImport, char[] name, boolean isOnDemand) { + String importString = new String(name); + if (isOnDemand) + importString += ".*"; + if (!anImport.getElementName().equals(importString)) + return false; + return true; +} +protected boolean isIdentical(IMethod method, char[] name, char[][] parameterTypes) { + if (!equals(method.getElementName(), name)) + return false; + String[] parameters = method.getParameterTypes(); + if (parameters == null || parameters.length == 0) { + if (parameterTypes == null || parameterTypes.length == 0) { + return true; + } else { + return false; + } + } + + if (parameters.length != parameterTypes.length) + return false; + for(int i = 0, length = parameters.length; i < length; i++) { + if (parameters[i] == null ^ parameterTypes[i] == null) + return false; + if (parameters[i] == null) + continue; + if (!parameters[i].equals(Signature.createTypeSignature(parameterTypes[i], false))) + return false; + } + return true; +} +protected boolean isIdentical(IPackageDeclaration aPackage, char[] name) { + if (!equals(aPackage.getElementName(), name)) + return false; + return true; +} +protected boolean isIdentical(IType type, char[] name) { + if (!equals(type.getElementName(), name)) + return false; + return true; +} +/** + * Advances the next element expected. + */ +protected void next() { + advance(); + if (fNextElement.getElementType() == IJavaElement.IMPORT_CONTAINER) + next(); +} +/** + * Pushes the children of the container on the stack + */ +protected void push(IJavaElement element) { + IParent parent = (IParent)element; + boolean hasChildren = false; + try { + hasChildren = parent.hasChildren(); + } catch (JavaModelException npe) {} + if (hasChildren) { + IJavaElement[] children = null; + try { + children = parent.getChildren(); + } catch (JavaModelException npe) {} + if (children != null) { + TraversalInfo info = new TraversalInfo(children, element.getElementName(), element.getElementType() == IJavaElement.TYPE); + fStack.push(info); + } + } +} +/** + * Updates the source ranges of the elements which weren't effected by + * the parse, but follow the parsed elements. + */ +void updateSourceRanges() { +} +}
diff --git a/model/org/eclipse/jdt/internal/core/Initializer.java b/model/org/eclipse/jdt/internal/core/Initializer.java index 9bcbca5..6f7cedd 100644 --- a/model/org/eclipse/jdt/internal/core/Initializer.java +++ b/model/org/eclipse/jdt/internal/core/Initializer.java
@@ -18,7 +18,7 @@ /* package */ class Initializer extends Member implements IInitializer { protected Initializer(IType parent, int occurrenceCount) { - super(INITIALIZER, parent, ""/*nonNLS*/); + super(INITIALIZER, parent, ""); // 0 is not valid: this first occurrence is occurrence 1. if (occurrenceCount <= 0) throw new IllegalArgumentException(); @@ -70,16 +70,16 @@ */ protected void toStringInfo(int tab, StringBuffer buffer, Object info) { if (info == null) { - buffer.append("<initializer>"/*nonNLS*/); - buffer.append(" (not open)"/*nonNLS*/); + buffer.append("<initializer>"); + buffer.append(" (not open)"); } else { try { if (Flags.isStatic(this.getFlags())) { - buffer.append("static "/*nonNLS*/); + buffer.append("static "); } - buffer.append("initializer"/*nonNLS*/); + buffer.append("initializer"); } catch (JavaModelException e) { - buffer.append("<JavaModelException in toString of "/*nonNLS*/ + getElementName()); + buffer.append("<JavaModelException in toString of " + getElementName()); } } }
diff --git a/model/org/eclipse/jdt/internal/core/JarEntryFile.java b/model/org/eclipse/jdt/internal/core/JarEntryFile.java index 72d0914..eac61c7 100644 --- a/model/org/eclipse/jdt/internal/core/JarEntryFile.java +++ b/model/org/eclipse/jdt/internal/core/JarEntryFile.java
@@ -62,6 +62,6 @@ * @see IStorage#isReadOnly() */ public String toString() { - return "JarEntryFile["/*nonNLS*/+this.zipName+"::"/*nonNLS*/+this.entryName+"]"/*nonNLS*/; + return "JarEntryFile["+this.zipName+"::"+this.entryName+"]"; } }
diff --git a/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java b/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java index 945ac02..b916120 100644 --- a/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java +++ b/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
@@ -65,7 +65,7 @@ try { verifyAttachSource(zipPath); if (monitor != null) { - monitor.beginTask(Util.bind("element.attachingSource"/*nonNLS*/), 2); + monitor.beginTask("Attaching source...", 2); } SourceMapper mapper= null; SourceMapper oldMapper= getSourceMapper(); @@ -377,14 +377,14 @@ Object target = JavaModel.getTarget(workspaceRoot, entry.getSourceAttachmentPath(), true); if (target instanceof IFile){ IFile file = (IFile) target; - if ("jar"/*nonNLS*/.equalsIgnoreCase(file.getFileExtension()) || "zip"/*nonNLS*/.equalsIgnoreCase(file.getFileExtension())){ + if ("jar".equalsIgnoreCase(file.getFileExtension()) || "zip".equalsIgnoreCase(file.getFileExtension())){ return entry; } } if (target instanceof java.io.File){ java.io.File file = (java.io.File) target; - String name = file.getName(); - if (Util.endsWithIgnoreCase(name, ".jar"/*nonNLS*/) || Util.endsWithIgnoreCase(name, ".zip"/*nonNLS*/)){ + String name = file.getName().toLowerCase(); + if (name.endsWith(".jar") || name.endsWith(".zip")){ return entry; } } @@ -404,15 +404,14 @@ Object target = JavaModel.getTarget(workspaceRoot, entry.getSourceAttachmentPath(), true); if (target instanceof IFile){ IFile file = (IFile) target; - String name = file.getName(); - if (Util.endsWithIgnoreCase(name, ".jar"/*nonNLS*/) || Util.endsWithIgnoreCase(name, ".zip"/*nonNLS*/)){ + if ("jar".equalsIgnoreCase(file.getFileExtension()) || "zip".equalsIgnoreCase(file.getFileExtension())){ return entry; } } if (target instanceof java.io.File){ java.io.File file = (java.io.File) target; - String name = file.getName(); - if (Util.endsWithIgnoreCase(name, ".jar"/*nonNLS*/) || Util.endsWithIgnoreCase(name, ".zip"/*nonNLS*/)){ + String name = file.getName().toLowerCase(); + if (name.endsWith(".jar") || name.endsWith(".zip")){ return entry; } } @@ -503,7 +502,7 @@ if (recommendation != null){ propertyString = recommendation.getSourceAttachmentPath().toString() + ATTACHMENT_PROPERTY_DELIMITER - + (recommendation.getSourceAttachmentRootPath() == null ? ""/*nonNLS*/ : recommendation.getSourceAttachmentRootPath().toString()); + + (recommendation.getSourceAttachmentRootPath() == null ? "" : recommendation.getSourceAttachmentRootPath().toString()); getWorkspace().getRoot().setPersistentProperty(qName, propertyString); } } @@ -520,7 +519,7 @@ ZipFile jarFile = null; try { jarFile = getJar(); - return new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: "/*nonNLS*/ + jarFile.getName()); + return new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + jarFile.getName()); } catch (CoreException e) { throw new JavaModelException(e); } finally {
diff --git a/model/org/eclipse/jdt/internal/core/JavaElement.java b/model/org/eclipse/jdt/internal/core/JavaElement.java index 286bcd3..a42fa66 100644 --- a/model/org/eclipse/jdt/internal/core/JavaElement.java +++ b/model/org/eclipse/jdt/internal/core/JavaElement.java
@@ -69,7 +69,7 @@ * Constructs a handle for a java element of the specified type, with * the given parent element and name. * - * @param type - one of the constants defined in IJavaLanguageElement + * @param type - one of the constants defined in IJavaLanguageElementTypes * * @exception IllegalArgumentException if the type is not one of the valid * Java element type constants @@ -77,7 +77,7 @@ */ protected JavaElement(int type, IJavaElement parent, String name) throws IllegalArgumentException { if (type < JAVA_MODEL || type > IMPORT_DECLARATION) { - throw new IllegalArgumentException(Util.bind("element.invalidType"/*nonNLS*/)); + throw new IllegalArgumentException("type is not one of the defined constants"); } fLEType= type; fParent= parent; @@ -516,7 +516,7 @@ protected String tabString(int tab) { StringBuffer buffer = new StringBuffer(); for (int i = tab; i > 0; i--) - buffer.append(" "/*nonNLS*/); + buffer.append(" "); return buffer.toString(); } /** @@ -554,11 +554,11 @@ protected void toStringAncestors(StringBuffer buffer) { JavaElement parent = (JavaElement)this.getParent(); if (parent != null) { - buffer.append(" [in "/*nonNLS*/); + buffer.append(" [in "); Object parentInfo = fgJavaModelManager.getInfo(parent); parent.toStringInfo(0, buffer, parentInfo); parent.toStringAncestors(buffer); - buffer.append("]"/*nonNLS*/); + buffer.append("]"); } } /** @@ -568,7 +568,7 @@ if (info == null || !(info instanceof JavaElementInfo)) return; IJavaElement[] children = ((JavaElementInfo)info).getChildren(); for (int i = 0; i < children.length; i++) { - buffer.append("\n"/*nonNLS*/); + buffer.append("\n"); ((JavaElement)children[i]).toString(tab + 1, buffer); } } @@ -578,7 +578,7 @@ protected void toStringInfo(int tab, StringBuffer buffer, Object info) { buffer.append(getElementName()); if (info == null) { - buffer.append(" (not open)"/*nonNLS*/); + buffer.append(" (not open)"); } } /**
diff --git a/model/org/eclipse/jdt/internal/core/JavaElementDelta.java b/model/org/eclipse/jdt/internal/core/JavaElementDelta.java index 35fd0e0..9a7e3f6 100644 --- a/model/org/eclipse/jdt/internal/core/JavaElementDelta.java +++ b/model/org/eclipse/jdt/internal/core/JavaElementDelta.java
@@ -477,7 +477,7 @@ buffer.append('\t'); } buffer.append(((JavaElement)getElement()).toDebugString()); - buffer.append("["/*nonNLS*/); + buffer.append("["); switch (getKind()) { case IJavaElementDelta.ADDED : buffer.append('+'); @@ -492,68 +492,68 @@ buffer.append('?'); break; } - buffer.append("]: {"/*nonNLS*/); + buffer.append("]: {"); int changeFlags = getFlags(); boolean prev = false; if ((changeFlags & IJavaElementDelta.F_CHILDREN) != 0) { if (prev) - buffer.append(" | "/*nonNLS*/); - buffer.append("CHILDREN"/*nonNLS*/); + buffer.append(" | "); + buffer.append("CHILDREN"); prev = true; } if ((changeFlags & IJavaElementDelta.F_CONTENT) != 0) { if (prev) - buffer.append(" | "/*nonNLS*/); - buffer.append("CONTENT"/*nonNLS*/); + buffer.append(" | "); + buffer.append("CONTENT"); prev = true; } if ((changeFlags & IJavaElementDelta.F_MOVED_FROM) != 0) { if (prev) - buffer.append(" | "/*nonNLS*/); - buffer.append("MOVED_FROM("/*nonNLS*/ + ((JavaElement)getMovedFromElement()).toDebugString() + ")"/*nonNLS*/); + buffer.append(" | "); + buffer.append("MOVED_FROM(" + ((JavaElement)getMovedFromElement()).toDebugString() + ")"); prev = true; } if ((changeFlags & IJavaElementDelta.F_MOVED_TO) != 0) { if (prev) - buffer.append(" | "/*nonNLS*/); - buffer.append("MOVED_TO("/*nonNLS*/ + ((JavaElement)getMovedToElement()).toDebugString() + ")"/*nonNLS*/); + buffer.append(" | "); + buffer.append("MOVED_TO(" + ((JavaElement)getMovedToElement()).toDebugString() + ")"); prev = true; } if ((changeFlags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0) { if (prev) - buffer.append(" | "/*nonNLS*/); - buffer.append("ADDED TO CLASSPATH"/*nonNLS*/); + buffer.append(" | "); + buffer.append("ADDED TO CLASSPATH"); prev = true; } if ((changeFlags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0) { if (prev) - buffer.append(" | "/*nonNLS*/); - buffer.append("REMOVED FROM CLASSPATH"/*nonNLS*/); + buffer.append(" | "); + buffer.append("REMOVED FROM CLASSPATH"); prev = true; } if ((changeFlags & IJavaElementDelta.F_CLASSPATH_REORDER) != 0) { if (prev) - buffer.append(" | "/*nonNLS*/); - buffer.append("REORDERED IN CLASSPATH"/*nonNLS*/); + buffer.append(" | "); + buffer.append("REORDERED IN CLASSPATH"); prev = true; } if ((changeFlags & IJavaElementDelta.F_MODIFIERS) != 0) { if (prev) - buffer.append(" | "/*nonNLS*/); - buffer.append("MODIFIERS CHANGED"/*nonNLS*/); + buffer.append(" | "); + buffer.append("MODIFIERS CHANGED"); prev = true; } if ((changeFlags & IJavaElementDelta.F_SUPER_TYPES) != 0) { if (prev) - buffer.append(" | "/*nonNLS*/); - buffer.append("SUPER TYPES CHANGED"/*nonNLS*/); + buffer.append(" | "); + buffer.append("SUPER TYPES CHANGED"); prev = true; } - buffer.append("}"/*nonNLS*/); + buffer.append("}"); IJavaElementDelta[] children = getAffectedChildren(); if (children != null) { for (int i = 0; i < children.length; ++i) { - buffer.append("\n"/*nonNLS*/); + buffer.append("\n"); buffer.append(((JavaElementDelta) children[i]).toDebugString(depth + 1)); } }
diff --git a/model/org/eclipse/jdt/internal/core/JavaElementDeltaBuilder.java b/model/org/eclipse/jdt/internal/core/JavaElementDeltaBuilder.java index 3a9be1d..432e46a 100644 --- a/model/org/eclipse/jdt/internal/core/JavaElementDeltaBuilder.java +++ b/model/org/eclipse/jdt/internal/core/JavaElementDeltaBuilder.java
@@ -422,7 +422,7 @@ } public String toString() { StringBuffer buffer = new StringBuffer(); - buffer.append("Built delta:\n"/*nonNLS*/); + buffer.append("Built delta:\n"); buffer.append(this.delta.toString()); return buffer.toString(); }
diff --git a/model/org/eclipse/jdt/internal/core/JavaModel.java b/model/org/eclipse/jdt/internal/core/JavaModel.java index a359be8..9583039 100644 --- a/model/org/eclipse/jdt/internal/core/JavaModel.java +++ b/model/org/eclipse/jdt/internal/core/JavaModel.java
@@ -35,7 +35,7 @@ * @exception Error if called more than once */ protected JavaModel(IWorkspace workspace) throws Error { - super(JAVA_MODEL, null, ""/*nonNLS*/ /*workspace has empty name*/); + super(JAVA_MODEL, null, "" /*workspace has empty name*/); this.workspace = workspace; } private void cleanupCycleMarkers() { @@ -102,7 +102,7 @@ if (generateMarkerOnError) { try { IMarker marker = this.workspace.getRoot().getProject(dependentProjectName).createMarker(IJavaModelMarker.TRANSIENT_PROBLEM); - marker.setAttribute(IMarker.MESSAGE, Util.bind("classpath.cycle"/*nonNLS*/)); + marker.setAttribute(IMarker.MESSAGE, "A cycle was detected in the project's classpath"); marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH); marker.setAttribute(IMarker.LOCATION, dependentProjectName); marker.setAttribute(IJavaModelMarker.CYCLE_DETECTED, dependentProjectName); @@ -374,8 +374,7 @@ * contribution to a memento. */ protected char getHandleMementoDelimiter(){ - Assert.isTrue(false, Util.bind("assert.shouldNotImplement"/*nonNLS*/)); - return 0; + throw new Error("should not be called"); } /** * @see IJavaElement @@ -411,7 +410,7 @@ } else if (resource.getType() == IResource.PROJECT) { return new JavaProject((IProject)resource, this); } else { - throw new IllegalArgumentException(Util.bind("element.invalidResourceForProject"/*nonNLS*/)); + throw new IllegalArgumentException("Illegal argument - must be one of IProject, IFolder, or IFile"); } } /** @@ -481,9 +480,9 @@ * @private Debugging purposes */ protected void toStringInfo(int tab, StringBuffer buffer, Object info) { - buffer.append("Java Model"/*nonNLS*/); + buffer.append("Java Model"); if (info == null) { - buffer.append(" (not open)"/*nonNLS*/); + buffer.append(" (not open)"); } }
diff --git a/model/org/eclipse/jdt/internal/core/JavaModelManager.java b/model/org/eclipse/jdt/internal/core/JavaModelManager.java index 7a88eb0..d910935 100644 --- a/model/org/eclipse/jdt/internal/core/JavaModelManager.java +++ b/model/org/eclipse/jdt/internal/core/JavaModelManager.java
@@ -93,12 +93,12 @@ /** * Local Java workspace properties file name (generated inside JavaCore plugin state location) */ - private static final String WKS_PROP_FILENAME= "workspace.properties"/*nonNLS*/; + private static final String WKS_PROP_FILENAME= "workspace.properties"; /** * Name of the handle id attribute in a Java marker */ - private static final String ATT_HANDLE_ID= "org.eclipse.jdt.internal.core.JavaModelManager.handleId"/*nonNLS*/; + private static final String ATT_HANDLE_ID= "org.eclipse.jdt.internal.core.JavaModelManager.handleId"; /** * Table from IProject to PerProjectInfo. @@ -129,7 +129,7 @@ /** * Line separator to use throughout the JavaModel for any source edit operation */ - public static String LINE_SEPARATOR = System.getProperty("line.separator"/*nonNLS*/); + public static String LINE_SEPARATOR = System.getProperty("line.separator"); /** * Constructs a new JavaModelManager */ @@ -359,18 +359,6 @@ } continue; } - if (optionName.equals(JavaCore.COMPILER_PB_NON_EXTERNALIZED_STRING_LITERAL)){ - - if (optionValue.equals(JavaCore.WARNING)){ - compilerOptions.handleNonExternalizedStringLiteralAsWarning(true); - continue; - } - if (optionValue.equals(JavaCore.IGNORE)){ - compilerOptions.handleNonExternalizedStringLiteralAsWarning(false); - continue; - } - continue; - } } return compilerOptions.getConfigurableOptions(Locale.getDefault()); } @@ -483,7 +471,7 @@ return null; } JavaModel model= (JavaModel) getJavaModel(workspace); - if (memento.equals(""/*nonNLS*/)){ // workspace memento + if (memento.equals("")){ // workspace memento return model; } int modelEnd= memento.indexOf(JavaElement.JEM_JAVAPROJECT); @@ -584,7 +572,7 @@ try { modelInfo.fJavaModel.close(); } catch (JavaModelException e) { - Assert.isTrue(false, Util.bind("element.onlyOneJavaModel"/*nonNLS*/)); + Assert.isTrue(false, "Cannot instantiate more than one Java Model"); return null; } } @@ -592,7 +580,7 @@ if (modelInfo == null || modelInfo.workspace.equals(workspace)) { return new JavaModel(workspace); } else { - Assert.isTrue(false, Util.bind("element.onlyOneJavaModel"/*nonNLS*/)); + Assert.isTrue(false, "Cannot instantiate more than one Java Model"); return null; } @@ -618,7 +606,7 @@ if (state == null && JavaBuilder.SAVE_ENABLED && !info.triedRead) { info.triedRead= true; try { - if (monitor != null) monitor.subTask(Util.bind("build.readStateProgress"/*nonNLS*/, project.getName())); + if (monitor != null) monitor.subTask("Reading saved built state of "+project.getName()); state= readState(info); info.setLastBuiltState(state); } catch (CoreException e) { @@ -663,12 +651,12 @@ if (!project.exists()) return null; IPluginDescriptor descr= JavaCore.getJavaCore().getDescriptor(); IPath workingLocation= project.getPluginWorkingLocation(descr); - return workingLocation.append("state.dat"/*nonNLS*/).toFile(); + return workingLocation.append("state.dat").toFile(); } public String getVariablesAsXMLString() throws CoreException { Document document = new DocumentImpl(); - Element rootElement = document.createElement("variables"/*nonNLS*/); + Element rootElement = document.createElement("variables"); document.appendChild(rootElement); String[] variables = JavaCore.getClasspathVariableNames(); @@ -676,9 +664,9 @@ for (int i= 0; i < variables.length; ++i) { String var = variables[i]; IPath varPath = JavaCore.getClasspathVariable(var); - Element varElement= document.createElement("variable"/*nonNLS*/); - varElement.setAttribute("name"/*nonNLS*/, var); - varElement.setAttribute("path"/*nonNLS*/, varPath.toString()); + Element varElement= document.createElement("variable"); + varElement.setAttribute("name", var); + varElement.setAttribute("path", varPath.toString()); rootElement.appendChild(varElement); } @@ -720,7 +708,7 @@ } else if (!path.isAbsolute()) { file= root.getFile(path); if (file == null || file.getType() != IResource.FILE) { - throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound"/*nonNLS*/), null)); + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "file not found", null)); } ensureLocal(file); fileSystemPath= file.getLocation().toOSString(); @@ -731,7 +719,7 @@ try { return new ZipFile(fileSystemPath); } catch (IOException e) { - throw new CoreException(new Status(Status.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("status.IOException"/*nonNLS*/), e)); + throw new CoreException(new Status(Status.ERROR, JavaCore.PLUGIN_ID, -1, "IOException", e)); } } /** @@ -751,7 +739,7 @@ public void loadVariables() throws CoreException { String xmlString = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty( - new QualifiedName(JavaCore.PLUGIN_ID, "variables"/*nonNLS*/)); + new QualifiedName(JavaCore.PLUGIN_ID, "variables")); try { if (xmlString != null) readVariables(xmlString); } catch(IOException e){ @@ -846,13 +834,13 @@ try { String pluginID= in.readUTF(); if (!pluginID.equals(JavaCore.PLUGIN_ID)) - throw new IOException(Util.bind("build.wrongFileFormat"/*nonNLS*/)); + throw new IOException("Wrong file format"); String kind= in.readUTF(); - if (!kind.equals("STATE"/*nonNLS*/)) - throw new IOException(Util.bind("build.wrongFileFormat"/*nonNLS*/)); + if (!kind.equals("STATE")) + throw new IOException("Wrong file format"); int version= in.readInt(); if (version != 0x0001) - throw new IOException(Util.bind("build.unhandledVersionFormat"/*nonNLS*/)); + throw new IOException("Unhandled version of file format"); boolean hasState= in.readBoolean(); IState state= null; if (hasState) { @@ -876,15 +864,15 @@ DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); cpElement = parser.parse(new InputSource(reader)).getDocumentElement(); } catch(SAXException e) { - throw new IOException(Util.bind("variable.badFormat"/*nonNLS*/)); + throw new IOException("bad format"); } catch(ParserConfigurationException e){ reader.close(); - throw new IOException(Util.bind("variable.badFormat"/*nonNLS*/)); + throw new IOException("bad format"); } finally { reader.close(); } - if (!cpElement.getNodeName().equalsIgnoreCase("variables"/*nonNLS*/)) { - throw new IOException(Util.bind("variable.badFormat"/*nonNLS*/)); + if (!cpElement.getNodeName().equalsIgnoreCase("variables")) { + throw new IOException("bad format"); } NodeList list= cpElement.getChildNodes(); Vector variables = new Vector(); @@ -894,11 +882,11 @@ short type= node.getNodeType(); if (type == Node.ELEMENT_NODE) { Element element= (Element) node; - if (element.getNodeName().equalsIgnoreCase("variable"/*nonNLS*/)) { - String varName = element.getAttribute("name"/*nonNLS*/); - String varPath = element.getAttribute("path"/*nonNLS*/); + if (element.getNodeName().equalsIgnoreCase("variable")) { + String varName = element.getAttribute("name"); + String varPath = element.getAttribute("path"); try { - JavaCore.setClasspathVariable(varName, new Path(varPath), null); + JavaCore.setClasspathVariable(varName, new Path(varPath)); } catch(JavaModelException e){ } catch(RuntimeException e){ } @@ -1057,7 +1045,7 @@ if (vStats != null) { IStatus[] stats= new IStatus[vStats.size()]; vStats.copyInto(stats); - throw new CoreException(new MultiStatus(JavaCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"/*nonNLS*/), null)); + throw new CoreException(new MultiStatus(JavaCore.PLUGIN_ID, IStatus.ERROR, stats, "Error saving builder states", null)); } } /** @@ -1065,7 +1053,7 @@ */ private void saveState(PerProjectInfo info) throws CoreException { - if (VERBOSE) System.out.println(Util.bind("build.saveStateProgress"/*nonNLS*/, info.project.getName())); + if (VERBOSE) System.out.println("Saving Java Image Builder state for project " + info.project.getName()); long t= System.currentTimeMillis(); File file= getSerializationFile(info.project); if (file == null) return; @@ -1073,7 +1061,7 @@ DataOutputStream out= new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); try { out.writeUTF(JavaCore.PLUGIN_ID); - out.writeUTF("STATE"/*nonNLS*/); + out.writeUTF("STATE"); out.writeInt(0x0001); IState state= info.getLastBuiltState(); if (state == null) { @@ -1090,16 +1078,16 @@ file.delete(); } catch(SecurityException se){ } - throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("build.cannotSaveState"/*nonNLS*/, info.project.getName()), e)); + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error saving last build state for project "+ info.project.getFullPath(), e)); } catch (IOException e) { try { file.delete(); } catch(SecurityException se){ } - throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("build.cannotSaveState"/*nonNLS*/, info.project.getName()), e)); + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error saving last build state for project "+ info.project.getFullPath(), e)); } t= System.currentTimeMillis() - t; - if (VERBOSE) System.out.println(Util.bind("build.saveStateComplete"/*nonNLS*/, String.valueOf(t))); + if (VERBOSE) System.out.println(" Saved in " + t + "ms"); } /** * Saves the built state for the project if it has been changed since last save. @@ -1119,7 +1107,7 @@ } public void saveVariables() throws CoreException { ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty( - new QualifiedName(JavaCore.PLUGIN_ID, "variables"/*nonNLS*/), + new QualifiedName(JavaCore.PLUGIN_ID, "variables"), getVariablesAsXMLString()); } /**
diff --git a/model/org/eclipse/jdt/internal/core/JavaModelOperation.java b/model/org/eclipse/jdt/internal/core/JavaModelOperation.java index 822686b..b6ad6c2 100644 --- a/model/org/eclipse/jdt/internal/core/JavaModelOperation.java +++ b/model/org/eclipse/jdt/internal/core/JavaModelOperation.java
@@ -135,7 +135,7 @@ */ protected void checkCanceled() { if (isCanceled()) { - throw new OperationCanceledException(Util.bind("operation.cancelled"/*nonNLS*/)); + throw new OperationCanceledException("Operation cancelled"); } } /**
diff --git a/model/org/eclipse/jdt/internal/core/JavaModelStatus.java b/model/org/eclipse/jdt/internal/core/JavaModelStatus.java index c868e21..1795a2c 100644 --- a/model/org/eclipse/jdt/internal/core/JavaModelStatus.java +++ b/model/org/eclipse/jdt/internal/core/JavaModelStatus.java
@@ -52,13 +52,13 @@ */ public JavaModelStatus() { // no code for an multi-status - super(ERROR, JavaCore.PLUGIN_ID, 0, "JavaModelStatus"/*nonNLS*/, null); + super(ERROR, JavaCore.PLUGIN_ID, 0, "JavaModelStatus", null); } /** * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int code) { - super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus"/*nonNLS*/, null); + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); fElements= JavaElementInfo.fgEmptyChildren; } /** @@ -66,7 +66,7 @@ * elements. */ public JavaModelStatus(int code, IJavaElement[] elements) { - super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus"/*nonNLS*/, null); + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); fElements= elements; fPath= null; } @@ -74,7 +74,7 @@ * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int code, String string) { - super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus"/*nonNLS*/, null); + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); fElements= JavaElementInfo.fgEmptyChildren; fPath= null; fString = string; @@ -83,14 +83,14 @@ * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int code, Throwable throwable) { - super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus"/*nonNLS*/, throwable); + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", throwable); fElements= JavaElementInfo.fgEmptyChildren; } /** * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int code, IPath path) { - super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus"/*nonNLS*/, null); + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); fElements= JavaElementInfo.fgEmptyChildren; fPath= path; } @@ -113,7 +113,7 @@ * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(CoreException coreException) { - super(ERROR, JavaCore.PLUGIN_ID, CORE_EXCEPTION, "JavaModelStatus"/*nonNLS*/, coreException); + super(ERROR, JavaCore.PLUGIN_ID, CORE_EXCEPTION, "JavaModelStatus", coreException); fElements= JavaElementInfo.fgEmptyChildren; } protected int getBits() { @@ -140,89 +140,89 @@ if (getException() == null) { switch (getCode()) { case CORE_EXCEPTION : - return Util.bind("status.coreException"/*nonNLS*/); + return "Core exception."; case BUILDER_INITIALIZATION_ERROR: - return Util.bind("build.initializationError"/*nonNLS*/); + return "Builder initialization error."; case BUILDER_SERIALIZATION_ERROR: - return Util.bind("build.serializationError"/*nonNLS*/); + return "Builder serialization error."; case DEVICE_PATH: - return Util.bind("status.cannotUseDeviceOnPath"/*nonNLS*/, getPath().toString()); + return "Operation requires a path with no device. Path specified was: " + getPath().toString(); case DOM_EXCEPTION: - return Util.bind("status.JDOMError"/*nonNLS*/); + return "JDOM error."; case ELEMENT_DOES_NOT_EXIST: - return Util.bind("element.doesNotExist"/*nonNLS*/,fElements[0].getElementName()); + return fElements[0].getElementName() + " does not exist."; case EVALUATION_ERROR: - return Util.bind("status.evaluationError"/*nonNLS*/, getString()); + return "Evaluation error: " + getString(); case INDEX_OUT_OF_BOUNDS: - return Util.bind("status.indexOutOfBounds"/*nonNLS*/); + return "Index out of bounds."; case INVALID_CONTENTS: - return Util.bind("status.invalidContents"/*nonNLS*/); + return "Invalid contents specified."; case INVALID_DESTINATION: - return Util.bind("status.invalidDestination"/*nonNLS*/, fElements[0].getElementName()); + return "Invalid destination: " + fElements[0].getElementName(); case INVALID_ELEMENT_TYPES: - StringBuffer buff= new StringBuffer(Util.bind("operation.notSupported"/*nonNLS*/)); + StringBuffer buff= new StringBuffer("Operation not supported for specified element type(s): "); for (int i= 0; i < fElements.length; i++) { if (i > 0) { - buff.append(", "/*nonNLS*/); + buff.append(", "); } buff.append(fElements[0].getElementName()); } return buff.toString(); case INVALID_NAME: - return Util.bind("status.invalidName"/*nonNLS*/, getString()); + return "Invalid name specified: " + getString(); case INVALID_PACKAGE: - return Util.bind("status.invalidPackage"/*nonNLS*/, getString()); + return "Invalid package: " + getString(); case INVALID_PATH: - return Util.bind("status.invalidPath"/*nonNLS*/, getPath() == null ? "null"/*nonNLS*/ : getPath().toString()); + return "Invalid path: " + (getPath() == null ? "null" : getPath().toString()); case INVALID_PROJECT: - return Util.bind("status.invalidProject"/*nonNLS*/, getString()); + return "Invalid project: " + getString(); case INVALID_RESOURCE: - return Util.bind("status.invalidResource"/*nonNLS*/, getString()); + return "Invalid resource: " + getString(); case INVALID_RESOURCE_TYPE: - return Util.bind("status.invalidResourceType"/*nonNLS*/, getString()); + return "Invalid resource type for " + getString(); case INVALID_SIBLING: - return Util.bind("status.invalidSibling"/*nonNLS*/, fElements[0].getElementName()); + return "Invalid sibling: " + fElements[0].getElementName(); case IO_EXCEPTION: - return Util.bind("status.IOException"/*nonNLS*/); + return "IO exception."; case NAME_COLLISION: if (fElements != null && fElements.length > 0) { IJavaElement element = fElements[0]; String name = element.getElementName(); if (element instanceof IPackageFragment && name.equals(IPackageFragment.DEFAULT_PACKAGE_NAME)) { - return Util.bind("operation.cannotRenameDefaultPackage"/*nonNLS*/); + return "Default package cannot be renamed."; } } - return Util.bind("status.nameCollision"/*nonNLS*/); + return "Name collision."; case NO_ELEMENTS_TO_PROCESS: - return Util.bind("operation.needElements"/*nonNLS*/); + return "Operation requires one or more elements."; case NULL_NAME: - return Util.bind("operation.needName"/*nonNLS*/); + return "Operation requires a name."; case NULL_PATH: - return Util.bind("operation.needPath"/*nonNLS*/); + return "Operation requires a path."; case NULL_STRING: - return Util.bind("operation.needString"/*nonNLS*/); + return "Operation requires a string."; case PATH_OUTSIDE_PROJECT: - return Util.bind("operation.pathOutsideProject"/*nonNLS*/, getString(), fElements[0].getElementName()); + return "Illegal path specified: " + getPath().toString(); case READ_ONLY: IJavaElement element = fElements[0]; String name = element.getElementName(); if (element instanceof IPackageFragment && name.equals(IPackageFragment.DEFAULT_PACKAGE_NAME)) { - return Util.bind("status.defaultPackageReadOnly"/*nonNLS*/); + name = "Default package"; } - return Util.bind("status.readOnly"/*nonNLS*/, name); + return name + " is read-only."; case RELATIVE_PATH: - return Util.bind("operation.needAbsolutePath"/*nonNLS*/, getPath().toString()); + return "Operation requires an absolute path. Relative path specified was: " + getPath().toString(); case TARGET_EXCEPTION: - return Util.bind("status.targetException"/*nonNLS*/); + return "Target exception."; case UPDATE_CONFLICT: - return Util.bind("status.updateConflict"/*nonNLS*/); + return "Update conflict."; case NO_LOCAL_CONTENTS : - return Util.bind("status.noLocalContents"/*nonNLS*/, getPath().toString()); + return "Cannot find local contents for resource: "+ getPath().toString(); } return getString(); } else { if (getCode() == CORE_EXCEPTION){ - return Util.bind("status.coreExceptionWithArg"/*nonNLS*/, getException().getMessage()); + return "Core exception: " + getException().getMessage(); } return getException().getMessage(); } @@ -311,9 +311,9 @@ */ public String toString() { StringBuffer buffer = new StringBuffer(); - buffer.append("Java Model Status ["/*nonNLS*/); + buffer.append("Java Model Status ["); buffer.append(getMessage()); - buffer.append("]"/*nonNLS*/); + buffer.append("]"); return buffer.toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/JavaProject.java b/model/org/eclipse/jdt/internal/core/JavaProject.java index 9ca7292..f381308 100644 --- a/model/org/eclipse/jdt/internal/core/JavaProject.java +++ b/model/org/eclipse/jdt/internal/core/JavaProject.java
@@ -202,7 +202,7 @@ * This is the project bin folder */ protected IPath defaultOutputLocation() throws JavaModelException { - return getProject().getFullPath().append("bin"/*nonNLS*/); + return getProject().getFullPath().append("bin"); } /** * Returns true if this handle represents the same Java project @@ -245,14 +245,14 @@ // default to the first one return pkgFragments[0]; } - } else if (extension.equalsIgnoreCase("java"/*nonNLS*/) || extension.equalsIgnoreCase("class"/*nonNLS*/)) { + } else if (extension.equalsIgnoreCase("java") || extension.equalsIgnoreCase("class")) { IPath packagePath= path.removeLastSegments(1); String packageName= packagePath.toString().replace(IPath.SEPARATOR, '.'); String typeName= path.lastSegment(); typeName= typeName.substring(0, typeName.length() - extension.length() - 1); String qualifiedName= null; if (packageName.length() > 0) { - qualifiedName= packageName + "."/*nonNLS*/ + typeName; + qualifiedName= packageName + "." + typeName; } else { qualifiedName= typeName; } @@ -437,11 +437,18 @@ return getPackageFragmentRoots(); } /** + * @see IJavaProject + * @deprecated + */ + public IClasspathEntry[] getClasspath() throws JavaModelException { + return getRawClasspath(); + } + /** * Returns the XML String encoding of the class path. */ protected String getClasspathAsXMLString(IClasspathEntry[] classpath, IPath outputLocation) throws JavaModelException { Document doc= new DocumentImpl(); - Element cpElement= doc.createElement("classpath"/*nonNLS*/); + Element cpElement= doc.createElement("classpath"); doc.appendChild(cpElement); for (int i= 0; i < classpath.length; ++i) { @@ -452,9 +459,9 @@ if (outputLocation != null) { outputLocation= outputLocation.removeFirstSegments(1); outputLocation= outputLocation.makeRelative(); - Element oElement= doc.createElement("classpathentry"/*nonNLS*/); - oElement.setAttribute("kind"/*nonNLS*/, kindToString(ClasspathEntry.K_OUTPUT)); - oElement.setAttribute("path"/*nonNLS*/, outputLocation.toOSString()); + Element oElement= doc.createElement("classpathentry"); + oElement.setAttribute("kind", kindToString(ClasspathEntry.K_OUTPUT)); + oElement.setAttribute("path", outputLocation.toOSString()); cpElement.appendChild(oElement); } @@ -488,15 +495,15 @@ * of this project */ public QualifiedName getClasspathPropertyName() { - return new QualifiedName(JavaCore.PLUGIN_ID, "classpath"/*nonNLS*/); + return new QualifiedName(JavaCore.PLUGIN_ID, "classpath"); } /** * Returns the XML String encoding of the class path. */ protected static Element getEntryAsXMLElement(Document document, IClasspathEntry entry, IPath prefixPath) throws JavaModelException { - Element element= document.createElement("classpathentry"/*nonNLS*/); - element.setAttribute("kind"/*nonNLS*/, kindToString(entry.getEntryKind())); + Element element= document.createElement("classpathentry"); + element.setAttribute("kind", kindToString(entry.getEntryKind())); IPath path= entry.getPath(); if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE){ // translate to project relative from absolute (unless a device path) @@ -511,12 +518,12 @@ } } } - element.setAttribute("path"/*nonNLS*/, path.toString()); + element.setAttribute("path", path.toString()); if (entry.getSourceAttachmentPath() != null){ - element.setAttribute("sourcepath"/*nonNLS*/, entry.getSourceAttachmentPath().toString()); + element.setAttribute("sourcepath", entry.getSourceAttachmentPath().toString()); } if (entry.getSourceAttachmentRootPath() != null){ - element.setAttribute("rootpath"/*nonNLS*/, entry.getSourceAttachmentRootPath().toString()); + element.setAttribute("rootpath", entry.getSourceAttachmentRootPath().toString()); } return element; } @@ -589,8 +596,8 @@ * @see IJavaProject */ public IPackageFragmentRoot getPackageFragmentRoot(IResource resource) { - String name= resource.getName(); - if (Util.endsWithIgnoreCase(name,".jar"/*nonNLS*/) || Util.endsWithIgnoreCase(name,".zip"/*nonNLS*/)) { + String name= resource.getName().toUpperCase(); + if (name.endsWith(".JAR") || name.endsWith(".ZIP")) { return new JarPackageFragmentRoot(resource, this); } else { return new PackageFragmentRoot(resource, this); @@ -676,7 +683,7 @@ if (entry.getContentKind() == IPackageFragmentRoot.K_BINARY) { String ext= path.getFileExtension(); IPackageFragmentRoot root= null; - if (ext != null && (ext.equalsIgnoreCase("zip"/*nonNLS*/) || ext.equalsIgnoreCase("jar"/*nonNLS*/))) { + if (ext != null && (ext.equalsIgnoreCase("zip") || ext.equalsIgnoreCase("jar"))) { // jar // removeFirstSegment removes the part relative to the project which is retrieve // through workspace.getDefaultContentLocation @@ -931,15 +938,15 @@ * Returns the kind of a <code>PackageFragmentRoot</code> from its <code>String</code> form. */ static int kindFromString(String kindStr) { - if (kindStr.equalsIgnoreCase("prj"/*nonNLS*/)) + if (kindStr.equalsIgnoreCase("prj")) return IClasspathEntry.CPE_PROJECT; - if (kindStr.equalsIgnoreCase("var"/*nonNLS*/)) + if (kindStr.equalsIgnoreCase("var")) return IClasspathEntry.CPE_VARIABLE; - if (kindStr.equalsIgnoreCase("src"/*nonNLS*/)) + if (kindStr.equalsIgnoreCase("src")) return IClasspathEntry.CPE_SOURCE; - if (kindStr.equalsIgnoreCase("lib"/*nonNLS*/)) + if (kindStr.equalsIgnoreCase("lib")) return IClasspathEntry.CPE_LIBRARY; - if (kindStr.equalsIgnoreCase("output"/*nonNLS*/)) + if (kindStr.equalsIgnoreCase("output")) return ClasspathEntry.K_OUTPUT; return -1; } @@ -951,17 +958,17 @@ static String kindToString(int kind) { switch (kind) { case IClasspathEntry.CPE_PROJECT : - return "src"/*nonNLS*/; // backward compatibility + return "src"; // backward compatibility case IClasspathEntry.CPE_SOURCE : - return "src"/*nonNLS*/; + return "src"; case IClasspathEntry.CPE_LIBRARY : - return "lib"/*nonNLS*/; + return "lib"; case IClasspathEntry.CPE_VARIABLE : - return "var"/*nonNLS*/; + return "var"; case ClasspathEntry.K_OUTPUT : - return "output"/*nonNLS*/; + return "output"; default : - return "unknown"/*nonNLS*/; + return "unknown"; } } /** @@ -983,10 +990,31 @@ } /** * @see IJavaProject + * @deprecated + */ + public IClasspathEntry newLibraryEntry(IPath path) { + return JavaCore.newLibraryEntry(path, null, null); + } + /** + * @see IJavaProject + * @deprecated + */ + public IClasspathEntry newProjectEntry(IPath path) { + return JavaCore.newProjectEntry(path); + } + /** + * @see IJavaProject + * @deprecated + */ + public IClasspathEntry newSourceEntry(IPath path) { + return JavaCore.newSourceEntry(path); + } + /** + * @see IJavaProject */ public ITypeHierarchy newTypeHierarchy(IRegion region, IProgressMonitor monitor) throws JavaModelException { if (region == null) { - throw new IllegalArgumentException(Util.bind("hierarchy.nullRegion"/*nonNLS*/)); + throw new IllegalArgumentException("region cannot be null"); } CreateTypeHierarchyOperation op= new CreateTypeHierarchyOperation(null, region, this, true); runOperation(op, monitor); @@ -997,10 +1025,10 @@ */ public ITypeHierarchy newTypeHierarchy(IType type, IRegion region, IProgressMonitor monitor) throws JavaModelException { if (type == null) { - throw new IllegalArgumentException(Util.bind("hierarchy.nullFocusType"/*nonNLS*/)); + throw new IllegalArgumentException("type cannot be null"); } if (region == null) { - throw new IllegalArgumentException(Util.bind("hierarchy.nullRegion"/*nonNLS*/)); + throw new IllegalArgumentException("region cannot be null"); } CreateTypeHierarchyOperation op= new CreateTypeHierarchyOperation(type, region, this, true); runOperation(op, monitor); @@ -1067,15 +1095,15 @@ DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); cpElement = parser.parse(new InputSource(reader)).getDocumentElement(); } catch(SAXException e) { - throw new IOException(Util.bind("file.badFormat"/*nonNLS*/)); + throw new IOException("bad format"); } catch(ParserConfigurationException e){ reader.close(); - throw new IOException(Util.bind("file.badFormat"/*nonNLS*/)); + throw new IOException("bad format"); } finally { reader.close(); } - if (!cpElement.getNodeName().equalsIgnoreCase("classpath"/*nonNLS*/)) { - throw new IOException(Util.bind("file.badFormat"/*nonNLS*/)); + if (!cpElement.getNodeName().equalsIgnoreCase("classpath")) { + throw new IOException("bad format"); } NodeList list= cpElement.getChildNodes(); Vector paths= new Vector(); @@ -1085,9 +1113,9 @@ short type= node.getNodeType(); if (type == Node.ELEMENT_NODE) { Element cpeElement= (Element) node; - if (cpeElement.getNodeName().equalsIgnoreCase("classpathentry"/*nonNLS*/)) { - String cpeElementKind = cpeElement.getAttribute("kind"/*nonNLS*/); - String pathStr = cpeElement.getAttribute("path"/*nonNLS*/); + if (cpeElement.getNodeName().equalsIgnoreCase("classpathentry")) { + String cpeElementKind = cpeElement.getAttribute("kind"); + String pathStr = cpeElement.getAttribute("path"); // ensure path is absolute IPath path= new Path(pathStr); int kind= kindFromString(cpeElementKind); @@ -1095,10 +1123,10 @@ path= projectPath.append(path); } // source attachment info (optional) - String sourceAttachmentPathStr = cpeElement.getAttribute("sourcepath"/*nonNLS*/); - IPath sourceAttachmentPath = sourceAttachmentPathStr.equals(""/*nonNLS*/) ? null : new Path(sourceAttachmentPathStr); - String sourceAttachmentRootPathStr = cpeElement.getAttribute("rootpath"/*nonNLS*/); - IPath sourceAttachmentRootPath = sourceAttachmentRootPathStr.equals(""/*nonNLS*/) ? null : new Path(sourceAttachmentRootPathStr); + String sourceAttachmentPathStr = cpeElement.getAttribute("sourcepath"); + IPath sourceAttachmentPath = sourceAttachmentPathStr.equals("") ? null : new Path(sourceAttachmentPathStr); + String sourceAttachmentRootPathStr = cpeElement.getAttribute("rootpath"); + IPath sourceAttachmentRootPath = sourceAttachmentRootPathStr.equals("") ? null : new Path(sourceAttachmentRootPathStr); IClasspathEntry entry= createClasspathEntry(path, kind, sourceAttachmentPath, sourceAttachmentRootPath); if (entry == null) return null; @@ -1223,6 +1251,13 @@ } } /** + * @see IJavaProject + * @deprecated + */ + public void setClasspath(IClasspathEntry[] entries, IProgressMonitor monitor) throws JavaModelException { + setRawClasspath(entries, monitor, true); + } + /** * Update the Java command in the build spec (replace existing one if present, * add one first if none). */ @@ -1257,7 +1292,7 @@ */ public void setOutputLocation(IPath outputLocation, IProgressMonitor monitor) throws JavaModelException { if (outputLocation == null) { - throw new IllegalArgumentException(Util.bind("path.nullpath"/*nonNLS*/)); + throw new IllegalArgumentException("path cannot be null"); } if (outputLocation.equals(getOutputLocation())) { return; @@ -1425,10 +1460,11 @@ */ private void createClasspathProblemMarker(IClasspathEntry entry, String message){ try { + boolean isSourceAttachmentProblem = message.indexOf("source attachment") < 0; IMarker marker = getProject().createMarker(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER); marker.setAttribute(IMarker.MESSAGE, message); - marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING); - marker.setAttribute(IMarker.LOCATION, Util.bind("classpath.buildPath"/*nonNLS*/)); + marker.setAttribute(IMarker.SEVERITY, isSourceAttachmentProblem ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING); + marker.setAttribute(IMarker.LOCATION, "Build path"); } catch (CoreException e) { } } @@ -1447,6 +1483,98 @@ } /** + * Returns a message describing the problem related to this classpath entry if any, or null if entry is fine + * (i.e. if the given classpath entry denotes a valid element to be referenced onto a classpath). + */ + private String getClasspathEntryErrorMessage(IClasspathEntry entry, boolean checkSourceAttachment){ + IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); + IPath path = entry.getPath(); + + switch(entry.getEntryKind()){ + + // variable entry check + case IClasspathEntry.CPE_VARIABLE : + entry = JavaCore.getResolvedClasspathEntry(entry); + if (entry == null){ + return "Invalid project build path, references unbound variable path: "+path; + } + return getClasspathEntryErrorMessage(entry, checkSourceAttachment); + + + // library entry check + case IClasspathEntry.CPE_LIBRARY : + if (path != null && path.isAbsolute() && !path.isEmpty()) { + IPath sourceAttachment = entry.getSourceAttachmentPath(); + Object target = JavaModel.getTarget(workspaceRoot, path, true); + if (target instanceof IResource){ + IResource resolvedResource = (IResource) target; + switch(resolvedResource.getType()){ + case IResource.FILE : + String extension = resolvedResource.getFileExtension(); + if ("jar".equalsIgnoreCase(extension) || "zip".equalsIgnoreCase(extension)){ // internal binary archive + if (checkSourceAttachment + && sourceAttachment != null + && !sourceAttachment.isEmpty() + && JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){ + return "Invalid source attachment: " + sourceAttachment; + } + } + break; + case IResource.FOLDER : // internal binary folder + if (checkSourceAttachment + && sourceAttachment != null + && !sourceAttachment.isEmpty() + && JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){ + return "Invalid source attachment: " + sourceAttachment; + } + } + } else if (target instanceof File){ + if (checkSourceAttachment + && sourceAttachment != null + && !sourceAttachment.isEmpty() + && JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){ + return "Invalid source attachment: " + sourceAttachment; + } + } else { + return "Invalid project build path, missing library: "+ path; + } + } else { + return "Invalid project build path, illegal library path: "+path; + } + break; + + // project entry check + case IClasspathEntry.CPE_PROJECT : + if (path != null && path.isAbsolute() && !path.isEmpty()) { + IProject project = workspaceRoot.getProject(path.segment(0)); + try { + if (!project.exists() || !project.hasNature(JavaCore.NATURE_ID)){ + return "Invalid project build path, missing Java project: "+path.segment(0); + } + } catch (CoreException e){ + return "Invalid project build path, missing Java project: "+path.segment(0); + } + } else { + return "Invalid project build path, illegal project path: "+path; + } + break; + + // project source folder + case IClasspathEntry.CPE_SOURCE : + if (path != null && path.isAbsolute() && !path.isEmpty()) { + IPath projectPath= getProject().getFullPath(); + if (!projectPath.isPrefixOf(path) || JavaModel.getTarget(workspaceRoot, path, true) == null){ + return "Invalid project build path, illegal source folder path: "+path; + } + } else { + return "Invalid project build path, illegal source folder path: "+path; + } + break; + } + return null; + } + + /** * Internal variant which can create marker on project for invalid entries */ public IClasspathEntry[] getResolvedClasspath(boolean ignoreUnresolvedVariable, boolean generateMarkerOnError) throws JavaModelException { @@ -1460,12 +1588,6 @@ IClasspathEntry entry = classpath[i]; - /* validation if needed */ - if (generateMarkerOnError){ - IJavaModelStatus status = JavaConventions.validateClasspathEntry(this, entry, false); - if (!status.isOK()) createClasspathProblemMarker(entry, status.getMessage()); - } - /* resolve variables if any, unresolved ones are ignored */ if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE){ @@ -1477,12 +1599,15 @@ IPath variablePath = entry.getPath(); // for error reporting entry = JavaCore.getResolvedClasspathEntry(entry); if (entry == null){ + if (generateMarkerOnError) createClasspathProblemMarker(classpath[i], "unbound variable path: "+variablePath); if (!ignoreUnresolvedVariable){ throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND, variablePath.toString())); } } } if (entry != null){ + String msg; + if (generateMarkerOnError && (msg = getClasspathEntryErrorMessage(entry, false)) != null) createClasspathProblemMarker(classpath[i], msg); resolvedPath[index++] = entry; } }
diff --git a/model/org/eclipse/jdt/internal/core/MoveElementsOperation.java b/model/org/eclipse/jdt/internal/core/MoveElementsOperation.java index e9cbfbf..087bc30 100644 --- a/model/org/eclipse/jdt/internal/core/MoveElementsOperation.java +++ b/model/org/eclipse/jdt/internal/core/MoveElementsOperation.java
@@ -28,7 +28,7 @@ * for progress monitoring. */ protected String getMainTaskName() { - return Util.bind("operation.moveElementProgress"/*nonNLS*/); + return "Moving elements..."; } /** * @see CopyElementsOperation#isMove()
diff --git a/model/org/eclipse/jdt/internal/core/MoveResourceElementsOperation.java b/model/org/eclipse/jdt/internal/core/MoveResourceElementsOperation.java index 895def8..85afa93 100644 --- a/model/org/eclipse/jdt/internal/core/MoveResourceElementsOperation.java +++ b/model/org/eclipse/jdt/internal/core/MoveResourceElementsOperation.java
@@ -27,7 +27,7 @@ * @see MultiOperation */ protected String getMainTaskName() { - return Util.bind("operation.moveResourceProgress"/*nonNLS*/); + return "Moving resources..."; } /** * @see CopyResourceElementsOperation#isMove()
diff --git a/model/org/eclipse/jdt/internal/core/NameLookup.java b/model/org/eclipse/jdt/internal/core/NameLookup.java index 8ebdbe1..a8689e7 100644 --- a/model/org/eclipse/jdt/internal/core/NameLookup.java +++ b/model/org/eclipse/jdt/internal/core/NameLookup.java
@@ -152,7 +152,7 @@ if (index != -1) { cuName= cuName.substring(0, index); } - cuName += ".java"/*nonNLS*/; + cuName += ".java"; IPackageFragment[] frags= (IPackageFragment[]) fPackageFragments.get(pkgName); if (frags != null) { @@ -173,7 +173,7 @@ */ public IPackageFragment findPackageFragment(IPath path) { if (!path.isAbsolute()) { - throw new IllegalArgumentException(Util.bind("path.mustBeAbsolute"/*nonNLS*/)); + throw new IllegalArgumentException("Path must be absolute"); } IResource possibleFragment = workspace.getRoot().findMember(path); if (possibleFragment == null) { @@ -244,7 +244,7 @@ */ public IPackageFragmentRoot findPackageFragmentRoot(IPath path) { if (!path.isAbsolute()) { - throw new IllegalArgumentException(Util.bind("path.mustBeAbsolute"/*nonNLS*/)); + throw new IllegalArgumentException("Path must be absolute"); } for (int i= 0; i < fPackageFragmentRoots.length; i++) { IPackageFragmentRoot classpathRoot= fPackageFragmentRoots[i]; @@ -532,7 +532,7 @@ * the compilationUnits always will. So add it if we're looking for * an exact match. */ - String unitName= partialMatch ? matchName.toLowerCase() : matchName + ".java"/*nonNLS*/; + String unitName= partialMatch ? matchName.toLowerCase() : matchName + ".java"; for (int i= 0; i < length; i++) { if (requestor.isCanceled())
diff --git a/model/org/eclipse/jdt/internal/core/NonVoidMethodRequestor.java b/model/org/eclipse/jdt/internal/core/NonVoidMethodRequestor.java index e79947f..913e39c 100644 --- a/model/org/eclipse/jdt/internal/core/NonVoidMethodRequestor.java +++ b/model/org/eclipse/jdt/internal/core/NonVoidMethodRequestor.java
@@ -25,7 +25,7 @@ } public void acceptMethod(IMethod method) { try { - if (!Signature.getReturnType(method.getSignature()).equals("V"/*nonNLS*/)) { + if (!Signature.getReturnType(method.getSignature()).equals("V")) { super.acceptMethod(method); } } catch (JavaModelException npe) {
diff --git a/model/org/eclipse/jdt/internal/core/Openable.java b/model/org/eclipse/jdt/internal/core/Openable.java index cc6944b..2cdc8d2 100644 --- a/model/org/eclipse/jdt/internal/core/Openable.java +++ b/model/org/eclipse/jdt/internal/core/Openable.java
@@ -95,7 +95,7 @@ */ protected void codeComplete(org.eclipse.jdt.internal.compiler.env.ICompilationUnit cu, org.eclipse.jdt.internal.compiler.env.ICompilationUnit unitToSkip, int position, ICodeCompletionRequestor requestor) throws JavaModelException { if (requestor == null) { - throw new IllegalArgumentException(Util.bind("codeAssist.nullRequestor"/*nonNLS*/)); + throw new IllegalArgumentException("requestor cannot be null"); } if (position < -1 || position > getBuffer().getLength()) { throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INDEX_OUT_OF_BOUNDS));
diff --git a/model/org/eclipse/jdt/internal/core/OverflowingLRUCache.java b/model/org/eclipse/jdt/internal/core/OverflowingLRUCache.java index 2d49198..132f65f 100644 --- a/model/org/eclipse/jdt/internal/core/OverflowingLRUCache.java +++ b/model/org/eclipse/jdt/internal/core/OverflowingLRUCache.java
@@ -212,7 +212,7 @@ forwardListLength++; entry = entry._fNext; } - System.out.println("Forward length: "/*nonNLS*/ + forwardListLength); + System.out.println("Forward length: " + forwardListLength); int backwardListLength = 0; entry = fEntryQueueTail; @@ -220,7 +220,7 @@ backwardListLength++; entry = entry._fPrevious; } - System.out.println("Backward length: "/*nonNLS*/ + backwardListLength); + System.out.println("Backward length: " + backwardListLength); Enumeration keys = fEntryTable.keys(); java.util.Vector v = new java.util.Vector(); @@ -232,7 +232,7 @@ fCount = 1; } public String toString() { - return "Class: "/*nonNLS*/ + fClass + " has "/*nonNLS*/ + fCount + " entries."/*nonNLS*/; + return "Class: " + fClass + " has " + fCount + " entries."; } } java.util.Hashtable h = new java.util.Hashtable(); @@ -369,7 +369,7 @@ if(newLoadFactor <= 1.0 && newLoadFactor > 0.0) fLoadFactor = newLoadFactor; else - throw new IllegalArgumentException(Util.bind("cache.invalidLoadFactor"/*nonNLS*/)); + throw new IllegalArgumentException("incorrect load factor"); } /** * Sets the maximum amount of space that the cache can store @@ -397,7 +397,7 @@ */ public String toString() { return - "OverflowingLRUCache "/*nonNLS*/ + ((fCurrentSpace + fOverflow) * 100.0 / fSpaceLimit) + "% full\n"/*nonNLS*/ + + "OverflowingLRUCache " + ((fCurrentSpace + fOverflow) * 100.0 / fSpaceLimit) + "% full\n" + this.toStringContents(); } /**
diff --git a/model/org/eclipse/jdt/internal/core/PackageDeclaration.java b/model/org/eclipse/jdt/internal/core/PackageDeclaration.java index c774187..f744f07 100644 --- a/model/org/eclipse/jdt/internal/core/PackageDeclaration.java +++ b/model/org/eclipse/jdt/internal/core/PackageDeclaration.java
@@ -33,10 +33,10 @@ * @private Debugging purposes */ protected void toStringInfo(int tab, StringBuffer buffer, Object info) { - buffer.append("package "/*nonNLS*/); + buffer.append("package "); buffer.append(getElementName()); if (info == null) { - buffer.append(" (not open)"/*nonNLS*/); + buffer.append(" (not open)"); } } }
diff --git a/model/org/eclipse/jdt/internal/core/PackageFragment.java b/model/org/eclipse/jdt/internal/core/PackageFragment.java index 9ab3bb1..a953610 100644 --- a/model/org/eclipse/jdt/internal/core/PackageFragment.java +++ b/model/org/eclipse/jdt/internal/core/PackageFragment.java
@@ -45,9 +45,9 @@ int kind = getKind(); String extType; if (kind == IPackageFragmentRoot.K_SOURCE) { - extType = "java"/*nonNLS*/; + extType = "java"; } else { - extType = "class"/*nonNLS*/; + extType = "class"; } try { IResource[] members = ((IContainer) resource).members(); @@ -89,7 +89,7 @@ */ public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException { if (container == null) { - throw new IllegalArgumentException(Util.bind("operation.nullContainer"/*nonNLS*/)); + throw new IllegalArgumentException("container cannot be null"); } IJavaElement[] elements= new IJavaElement[] {this}; IJavaElement[] containers= new IJavaElement[] {container}; @@ -229,7 +229,7 @@ IJavaElement[] packages= ((IPackageFragmentRoot)getParent()).getChildren(); String name = getElementName(); int nameLength = name.length(); - String packageName = isDefaultPackage() ? name : name+"."/*nonNLS*/; + String packageName = isDefaultPackage() ? name : name+"."; for (int i= 0; i < packages.length; i++) { String otherName = packages[i].getElementName(); if (otherName.length() > nameLength && otherName.startsWith(packageName)) { @@ -249,7 +249,7 @@ */ public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException { if (container == null) { - throw new IllegalArgumentException(Util.bind("operation.nullContainer"/*nonNLS*/)); + throw new IllegalArgumentException("conatiner cannot be null"); } IJavaElement[] elements= new IJavaElement[] {this}; IJavaElement[] containers= new IJavaElement[] {container}; @@ -280,7 +280,7 @@ */ public void rename(String name, boolean force, IProgressMonitor monitor) throws JavaModelException { if (name == null) { - throw new IllegalArgumentException(Util.bind("element.nullName"/*nonNLS*/)); + throw new IllegalArgumentException("name cannot be null"); } IJavaElement[] elements= new IJavaElement[] {this}; IJavaElement[] dests= new IJavaElement[] {this.getParent()}; @@ -300,15 +300,15 @@ */ protected void toStringInfo(int tab, StringBuffer buffer, Object info) { if (getElementName().length() == 0) { - buffer.append("[default]"/*nonNLS*/); + buffer.append("[default]"); } else { buffer.append(getElementName()); } if (info == null) { - buffer.append(" (not open)"/*nonNLS*/); + buffer.append(" (not open)"); } else { if (tab > 0) { - buffer.append(" (...)"/*nonNLS*/); + buffer.append(" (...)"); } } }
diff --git a/model/org/eclipse/jdt/internal/core/PackageFragmentInfo.java b/model/org/eclipse/jdt/internal/core/PackageFragmentInfo.java index 6dc504d..45950b4 100644 --- a/model/org/eclipse/jdt/internal/core/PackageFragmentInfo.java +++ b/model/org/eclipse/jdt/internal/core/PackageFragmentInfo.java
@@ -43,7 +43,7 @@ IResource child = members[i]; if (child.getType() != IResource.FOLDER) { String extension = child.getProjectRelativePath().getFileExtension(); - if (!"java"/*nonNLS*/.equalsIgnoreCase(extension) && !"class"/*nonNLS*/.equalsIgnoreCase(extension)) { + if (!"java".equalsIgnoreCase(extension) && !"class".equalsIgnoreCase(extension)) { if (nonJavaResources.length == nonJavaResourcesCounter) { // resize System.arraycopy(
diff --git a/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java b/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java index 5de8071..57131b0 100644 --- a/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java +++ b/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java
@@ -55,7 +55,7 @@ // is actually the package fragment root) if (fResource.getType() == IResource.FOLDER || fResource.getType() == IResource.PROJECT) { Vector vChildren = new Vector(5); - computeFolderChildren((IContainer) fResource, ""/*nonNLS*/, vChildren); + computeFolderChildren((IContainer) fResource, "", vChildren); IJavaElement[] children = new IJavaElement[vChildren.size()]; vChildren.copyInto(children); info.setChildren(children); @@ -86,7 +86,7 @@ if (prefix.length() == 0) { newPrefix = member.getName(); } else { - newPrefix = prefix + "."/*nonNLS*/ + member.getName(); + newPrefix = prefix + "." + member.getName(); } // eliminate binary output only if nested inside direct subfolders if (!member.getFullPath().equals(outputLocationPath)) { @@ -219,7 +219,7 @@ StringBuffer name = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME); for (int i= mySegmentCount; i < pkgSegmentCount; i++) { if (i > mySegmentCount) { - name.append('.'); + name.append("."); } name.append(pkgPath.segment(i)); } @@ -296,12 +296,12 @@ */ protected void toStringInfo(int tab, StringBuffer buffer, Object info) { if (getElementName().length() == 0) { - buffer.append("[project root]"/*nonNLS*/); + buffer.append("[project root]"); } else { buffer.append(getElementName()); } if (info == null) { - buffer.append(" (not open)"/*nonNLS*/); + buffer.append(" (not open)"); } } }
diff --git a/model/org/eclipse/jdt/internal/core/PackageFragmentRootInfo.java b/model/org/eclipse/jdt/internal/core/PackageFragmentRootInfo.java index ff1c197..6bc01a3 100644 --- a/model/org/eclipse/jdt/internal/core/PackageFragmentRootInfo.java +++ b/model/org/eclipse/jdt/internal/core/PackageFragmentRootInfo.java
@@ -52,7 +52,7 @@ IResource member = members[i]; if (member.getType() == IResource.FILE) { String extension = member.getProjectRelativePath().getFileExtension(); - if (!"java"/*nonNLS*/.equalsIgnoreCase(extension) && !"class"/*nonNLS*/.equalsIgnoreCase(extension)) { + if (!"java".equalsIgnoreCase(extension) && !"class".equalsIgnoreCase(extension)) { if (project.findPackageFragmentRoot(member.getFullPath()) == null) { if (nonJavaResources.length == nonJavaResourcesCounter) { // resize
diff --git a/model/org/eclipse/jdt/internal/core/Problem.java b/model/org/eclipse/jdt/internal/core/Problem.java index cbcafc5..554dd53 100644 --- a/model/org/eclipse/jdt/internal/core/Problem.java +++ b/model/org/eclipse/jdt/internal/core/Problem.java
@@ -1,6 +1,5 @@ package org.eclipse.jdt.internal.core; - /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. @@ -11,7 +10,6 @@ import org.eclipse.jdt.internal.compiler.problem.*; import org.eclipse.jdt.internal.compiler.impl.*; - public class Problem implements IProblem, ProblemSeverities, ProblemIrritants { private char[] fileName; private int id; @@ -38,6 +36,85 @@ this.endPosition = endPosition; this.line = line; } +public String errorReportSource(ICompilationUnit compilationUnit) { + //extra from the source the innacurate token + //and "highlight" it using some underneath ^^^^^ + //put some context around too. + + //this code assumes that the font used in the console is fixed size + + //sanity ..... + if ((startPosition > endPosition) + || ((startPosition <= 0) && (endPosition <= 0))) + return "\n!! no source information available !!"; + + //regular behavior....(slow code) + + final int AROUND = 60; //increase this value to see more .... + final char SPACE = '\u0020'; + final char MARK = '^'; + final char TAB = '\t'; + char[] source = compilationUnit.getContents(); + //the next code tries to underline the token..... + //it assumes (for a good display) that token source does not + //contain any \r \n. This is false on statements ! + //(the code still works but the display is not optimal !) + + //compute the how-much-char we are displaying around the inaccurate token + int begin = startPosition >= source.length ? source.length - 1 : startPosition; + int relativeStart = 0; + int end = endPosition >= source.length ? source.length - 1 : endPosition; + int relativeEnd = 0; + label : for (relativeStart = 0;; relativeStart++) { + if (begin == 0) + break label; + if ((source[begin - 1] == '\n') || (source[begin - 1] == '\r')) + break label; + begin--; + } + label : for (relativeEnd = 0;; relativeEnd++) { + if ((end + 1)>= source.length) + break label; + if ((source[end + 1] == '\r') || (source[end + 1] == '\n')) { + break label; + } + end++; + } + //extract the message form the source + char[] extract = new char[end - begin + 1]; + System.arraycopy(source, begin, extract, 0, extract.length); + char c; + //remove all SPACE and TAB that begin the error message... + int trimLeftIndex = 0; + while (((c = extract[trimLeftIndex++]) == TAB) || (c == SPACE)) {}; + System.arraycopy( + extract, + trimLeftIndex - 1, + extract = new char[extract.length - trimLeftIndex + 1], + 0, + extract.length); + relativeStart -= trimLeftIndex; + //buffer spaces and tabs in order to reach the error position + int pos = 0; + char[] underneath = new char[extract.length]; // can't be bigger + for (int i = 0; i <= relativeStart; i++) { + if (extract[i] == TAB) { + underneath[pos++] = TAB; + } else { + underneath[pos++] = SPACE; + } + } + //mark the error position + for (int i = startPosition; + i <= (endPosition >= source.length ? source.length - 1 : endPosition); + i++) + underneath[pos++] = MARK; + //resize underneathto remove 'null' chars + System.arraycopy(underneath, 0, underneath = new char[pos], 0, pos); + + return " (at line " + String.valueOf(line) + ")" + //NON NLS + "\n\t" + new String(extract) + "\n\t" + new String(underneath); +} /** * Answer back the original arguments recorded into the problem. * @return java.lang.String[] @@ -136,14 +213,13 @@ } public String toString() { - - String s = "Pb("/*nonNLS*/ + (id & IgnoreCategoriesMask) + ") "/*nonNLS*/; + String s = "Pb(" + (id & IgnoreCategoriesMask) + ") "; if (message != null) { s += message; } else { if (arguments != null) for (int i = 0; i < arguments.length; i++) - s += " "/*nonNLS*/ + arguments[i]; + s += " " + arguments[i]; } return s; }
diff --git a/model/org/eclipse/jdt/internal/core/Region.java b/model/org/eclipse/jdt/internal/core/Region.java index 15b66de..2fd90b6 100644 --- a/model/org/eclipse/jdt/internal/core/Region.java +++ b/model/org/eclipse/jdt/internal/core/Region.java
@@ -137,7 +137,7 @@ for (int i= 0; i < roots.length; i++) { buffer.append(roots[i].getElementName()); if (i < (roots.length - 1)) { - buffer.append(", "/*nonNLS*/); + buffer.append(", "); } } buffer.append(']');
diff --git a/model/org/eclipse/jdt/internal/core/RenameElementsOperation.java b/model/org/eclipse/jdt/internal/core/RenameElementsOperation.java index 50a35bf..1a76475 100644 --- a/model/org/eclipse/jdt/internal/core/RenameElementsOperation.java +++ b/model/org/eclipse/jdt/internal/core/RenameElementsOperation.java
@@ -38,7 +38,7 @@ * @see MultiOperation */ protected String getMainTaskName() { - return Util.bind("operation.renameElementProgress"/*nonNLS*/); + return "Renaming elements..."; } /** * @see CopyElementsOperation#isRename()
diff --git a/model/org/eclipse/jdt/internal/core/RenameResourceElementsOperation.java b/model/org/eclipse/jdt/internal/core/RenameResourceElementsOperation.java index f26666b..75821a9 100644 --- a/model/org/eclipse/jdt/internal/core/RenameResourceElementsOperation.java +++ b/model/org/eclipse/jdt/internal/core/RenameResourceElementsOperation.java
@@ -34,7 +34,7 @@ * @see MultiOperation */ protected String getMainTaskName() { - return Util.bind("operation.renameResourceProgress"/*nonNLS*/); + return "Renaming resources..."; } /** * @see CopyResourceElementsOperation#isRename()
diff --git a/model/org/eclipse/jdt/internal/core/SearchableEnvironment.java b/model/org/eclipse/jdt/internal/core/SearchableEnvironment.java index 745ff1a..0fe7f8b 100644 --- a/model/org/eclipse/jdt/internal/core/SearchableEnvironment.java +++ b/model/org/eclipse/jdt/internal/core/SearchableEnvironment.java
@@ -94,7 +94,7 @@ for(int i = 0; i < lengthM1; i++) { buffer.append(compoundTypeName[i]); if (i + 1 != lengthM1) - buffer.append('.'); + buffer.append("."); } String className = new String(compoundTypeName[lengthM1]); return find(className, buffer.toString()); @@ -114,7 +114,7 @@ for(int i = 0; i < length; i++) { buffer.append(packages[i]); if (i + 1 != length) - buffer.append('.'); + buffer.append("."); } String className = new String(name); return find(className, buffer.toString()); @@ -238,7 +238,7 @@ if (parentPackageName[i] == null || isQualified(parentPackageName[i])) return false; buffer.append(parentPackageName[i]); - buffer.append('.'); + buffer.append("."); } if (isQualified(subPackageName)) { return false; @@ -272,7 +272,7 @@ * Returns a printable string for the array. */ protected String toStringChar(char[] name) { - return "["/*nonNLS*/ + new String(name) + "]"/*nonNLS*/; + return "[" + new String(name) + "]"; } /** * Returns a printable string for the array.
diff --git a/model/org/eclipse/jdt/internal/core/SelectionRequestor.java b/model/org/eclipse/jdt/internal/core/SelectionRequestor.java index bc94fbc..7aa2d63 100644 --- a/model/org/eclipse/jdt/internal/core/SelectionRequestor.java +++ b/model/org/eclipse/jdt/internal/core/SelectionRequestor.java
@@ -60,7 +60,7 @@ for (int i= 0, max = parameterTypeNames.length; i < max; i++) { String pkg = IPackageFragment.DEFAULT_PACKAGE_NAME; if (parameterPackageNames[i] != null && parameterPackageNames[i].length > 0) { - pkg = new String(parameterPackageNames[i]) + "."/*nonNLS*/; + pkg = new String(parameterPackageNames[i]) + "."; } parameterTypes[i]= Signature.createTypeSignature( pkg + new String(parameterTypeNames[i]), true);
diff --git a/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java b/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java index 8e622e3..d91296b 100644 --- a/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java +++ b/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java
@@ -57,7 +57,7 @@ * Sets the classpath of the pre-specified project. */ protected void executeOperation() throws JavaModelException { - beginTask(Util.bind("classpath.settingProgress"/*nonNLS*/), 2); + beginTask("Setting classpath...", 2); JavaProject project= ((JavaProject) getElementsToProcess()[0]); project.setRawClasspath0(this.newRawPath); @@ -164,7 +164,9 @@ if (!status.isOK()) { return status; } + IClasspathEntry[] classpath = this.newRawPath; IJavaProject javaProject = (IJavaProject)getElementToProcess(); + IPath projectPath= javaProject.getProject().getFullPath(); // retrieve output location IPath outputLocation; @@ -174,7 +176,46 @@ return e.getJavaModelStatus(); } - return JavaConventions.validateClasspath(javaProject, this.newRawPath, outputLocation); + // check if any source entries coincidates with binary output - in which case nesting inside output is legal + boolean allowNestingInOutput = false; + for (int i = 0 ; i < classpath.length; i++) { + if (classpath[i].getPath().equals(outputLocation)){ + allowNestingInOutput = true; + break; + } + } + + // check all entries + for (int i = 0 ; i < classpath.length; i++) { + IClasspathEntry entry = classpath[i]; + IPath entryPath = entry.getPath(); + + // no further check if entry coincidates with project or output location + if (entryPath.equals(projectPath)) continue; + if (entryPath.equals(outputLocation)) continue; + + // prevent nesting source entries in each other + if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE){ + for (int j = 0; j < classpath.length; j++){ + IClasspathEntry otherEntry = classpath[j]; + if (entry != otherEntry && otherEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE){ + if (entryPath.isPrefixOf(otherEntry.getPath())){ + return new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, entryPath); + } + } + } + } + // prevent nesting output location inside entry + if (entryPath.isPrefixOf(outputLocation)) { + return new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, entryPath); + } + + // prevent nesting entry inside output location - when distinct from project or a source folder + if (!allowNestingInOutput && outputLocation.isPrefixOf(entryPath)) { + return new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, entryPath); + } + } + return JavaModelStatus.VERIFIED_OK; } /**
diff --git a/model/org/eclipse/jdt/internal/core/SetOutputLocationOperation.java b/model/org/eclipse/jdt/internal/core/SetOutputLocationOperation.java index a21411e..a9b4895 100644 --- a/model/org/eclipse/jdt/internal/core/SetOutputLocationOperation.java +++ b/model/org/eclipse/jdt/internal/core/SetOutputLocationOperation.java
@@ -85,7 +85,7 @@ IPath relativePath = f.getFullPath().removeFirstSegments(segments); String name = relativePath.toOSString(); name = name.replace(File.pathSeparatorChar, '.'); - if (name.endsWith("."/*nonNLS*/)) { + if (name.endsWith(".")) { name = name.substring(0, name.length() - 1); } IPackageFragment pkg = root.getPackageFragment(name); @@ -104,7 +104,7 @@ * a package fragment. */ protected void executeOperation() throws JavaModelException { - beginTask(Util.bind("classpath.settingOutputLocationProgress"/*nonNLS*/), 2); + beginTask("Setting output location...", 2); JavaProject project= ((JavaProject) getElementsToProcess()[0]); IPath oldLocation= project.getOutputLocation(); @@ -166,6 +166,27 @@ if (!status.isOK()) { return status; } + if (fOutputLocation == null) { + return new JavaModelStatus(IJavaModelStatusConstants.NULL_PATH); + } + + if (fOutputLocation.isAbsolute()) { + IProject project = ((IJavaProject) fElementsToProcess[0]).getProject(); + + if (project.getFullPath().isPrefixOf(fOutputLocation)) { + //project relative path + String projectName = fOutputLocation.segment(0); + if (!projectName.equals(fElementsToProcess[0].getElementName())) { + //a workspace relative path outside of this project + return new JavaModelStatus(IJavaModelStatusConstants.PATH_OUTSIDE_PROJECT, fOutputLocation); + } + } else { + return new JavaModelStatus(IJavaModelStatusConstants.DEVICE_PATH, fOutputLocation); + } + } else { + return new JavaModelStatus(IJavaModelStatusConstants.RELATIVE_PATH, fOutputLocation); + } + // retrieve classpath IClasspathEntry[] classpath = null; IJavaProject javaProject= (IJavaProject)getElementToProcess(); @@ -175,6 +196,35 @@ } catch (JavaModelException e) { return e.getJavaModelStatus(); } - return JavaConventions.validateClasspath((IJavaProject) fElementsToProcess[0], classpath, fOutputLocation); + + // check if any source entries coincidates with binary output - in which case nesting inside output is legal + boolean allowNestingInOutput = false; + for (int i = 0 ; i < classpath.length; i++) { + if (classpath[i].getPath().equals(fOutputLocation)){ + allowNestingInOutput = true; + break; + } + } + + // check all entries + for (int i = 0 ; i < classpath.length; i++) { + IClasspathEntry entry = classpath[i]; + IPath entryPath = entry.getPath(); + + // no further check if entry coincidates with project or output location + if (entryPath.equals(projectPath)) continue; + if (entryPath.equals(fOutputLocation)) continue; + + // prevent nesting output location inside entry + if (entryPath.isPrefixOf(fOutputLocation)) { + return new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, fOutputLocation); + } + + // prevent nesting entry inside output location - when distinct from project or a source folder + if (!allowNestingInOutput && fOutputLocation.isPrefixOf(entryPath)) { + return new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, fOutputLocation); + } + } + return JavaModelStatus.VERIFIED_OK; } }
diff --git a/model/org/eclipse/jdt/internal/core/SourceField.java b/model/org/eclipse/jdt/internal/core/SourceField.java index 00d5b06..b9d102d 100644 --- a/model/org/eclipse/jdt/internal/core/SourceField.java +++ b/model/org/eclipse/jdt/internal/core/SourceField.java
@@ -53,14 +53,14 @@ protected void toStringInfo(int tab, StringBuffer buffer, Object info) { if (info == null) { buffer.append(getElementName()); - buffer.append(" (not open)"/*nonNLS*/); + buffer.append(" (not open)"); } else { try { buffer.append(Signature.toString(this.getTypeSignature())); - buffer.append(" "/*nonNLS*/); + buffer.append(" "); buffer.append(this.getElementName()); } catch (JavaModelException e) { - buffer.append("<JavaModelException in toString of "/*nonNLS*/ + getElementName()); + buffer.append("<JavaModelException in toString of " + getElementName()); } } }
diff --git a/model/org/eclipse/jdt/internal/core/SourceMapper.java b/model/org/eclipse/jdt/internal/core/SourceMapper.java index b38372f..1d2e716 100644 --- a/model/org/eclipse/jdt/internal/core/SourceMapper.java +++ b/model/org/eclipse/jdt/internal/core/SourceMapper.java
@@ -109,7 +109,7 @@ public SourceMapper(IPath zipPath, String rootPath, JavaModel model) { fZipPath= zipPath; fRootPath= rootPath.replace('\\', '/'); - if (fRootPath.endsWith("/"/*nonNLS*/)) { + if (fRootPath.endsWith("/")) { fRootPath = fRootPath.substring(0, fRootPath.lastIndexOf('/')); } fJavaModel= model; @@ -305,9 +305,15 @@ * code cannot be found. */ public char[] findSource(IType type, IBinaryType info) { - char[] sourceFileName = info.sourceFileName(); - if (sourceFileName == null) return null; // no source file attribute - String name = new String(sourceFileName); + String name= null; + // see 1FVVWZT + if (info instanceof ClassFileReader) { + char[] sourceFileName = ((ClassFileReader)info).sourceFileName(); + if (sourceFileName == null) return null; // no source file attribute + name = new String(sourceFileName); + } else { + return null; + } IPackageFragment pkgFrag = type.getPackageFragment(); if (!pkgFrag.isDefaultPackage()) { @@ -446,7 +452,7 @@ try { IProblemFactory factory= new DefaultProblemFactory(); SourceElementParser parser = new SourceElementParser(this, factory); - parser.parseCompilationUnit(new BasicCompilationUnit(contents, type.getElementName() + ".java"/*nonNLS*/), false); + parser.parseCompilationUnit(new BasicCompilationUnit(contents, type.getElementName() + ".java"), false); if (searchedElement != null) { ISourceRange range = this.getNameRange(searchedElement); return range;
diff --git a/model/org/eclipse/jdt/internal/core/SourceMethod.java b/model/org/eclipse/jdt/internal/core/SourceMethod.java index e522c94..ed982a6 100644 --- a/model/org/eclipse/jdt/internal/core/SourceMethod.java +++ b/model/org/eclipse/jdt/internal/core/SourceMethod.java
@@ -138,18 +138,18 @@ public String readableName() { StringBuffer buffer = new StringBuffer(super.readableName()); - buffer.append('('); + buffer.append("("); String[] parameterTypes = this.getParameterTypes(); int length; if (parameterTypes != null && (length = parameterTypes.length) > 0) { for (int i = 0; i < length; i++) { buffer.append(Signature.toString(parameterTypes[i])); if (i < length - 1) { - buffer.append(", "/*nonNLS*/); + buffer.append(", "); } } } - buffer.append(')'); + buffer.append(")"); return buffer.toString(); } /** @@ -192,31 +192,31 @@ protected void toStringInfo(int tab, StringBuffer buffer, Object info) { if (info == null) { buffer.append(getElementName()); - buffer.append(" (not open)"/*nonNLS*/); + buffer.append(" (not open)"); } else { try { if (Flags.isStatic(this.getFlags())) { - buffer.append("static "/*nonNLS*/); + buffer.append("static "); } if (!this.isConstructor()) { buffer.append(Signature.toString(this.getReturnType())); - buffer.append(' '); + buffer.append(" "); } buffer.append(this.getElementName()); - buffer.append('('); + buffer.append("("); String[] parameterTypes = this.getParameterTypes(); int length; if (parameterTypes != null && (length = parameterTypes.length) > 0) { for (int i = 0; i < length; i++) { buffer.append(Signature.toString(parameterTypes[i])); if (i < length - 1) { - buffer.append(", "/*nonNLS*/); + buffer.append(", "); } } } - buffer.append(')'); + buffer.append(")"); } catch (JavaModelException e) { - buffer.append("<JavaModelException in toString of "/*nonNLS*/ + getElementName()); + buffer.append("<JavaModelException in toString of " + getElementName()); } } }
diff --git a/model/org/eclipse/jdt/internal/core/SourceRange.java b/model/org/eclipse/jdt/internal/core/SourceRange.java index e0aa405..339d495 100644 --- a/model/org/eclipse/jdt/internal/core/SourceRange.java +++ b/model/org/eclipse/jdt/internal/core/SourceRange.java
@@ -33,11 +33,11 @@ } public String toString() { StringBuffer buffer = new StringBuffer(); - buffer.append("[offset="/*nonNLS*/); + buffer.append("[offset="); buffer.append(this.offset); - buffer.append(", length="/*nonNLS*/); + buffer.append(", length="); buffer.append(this.length); - buffer.append("]"/*nonNLS*/); + buffer.append("]"); return buffer.toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/SourceRefElement.java b/model/org/eclipse/jdt/internal/core/SourceRefElement.java index c0f0f42..843fcba 100644 --- a/model/org/eclipse/jdt/internal/core/SourceRefElement.java +++ b/model/org/eclipse/jdt/internal/core/SourceRefElement.java
@@ -23,7 +23,7 @@ */ public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException { if (container == null) { - throw new IllegalArgumentException(Util.bind("operation.nullContainer"/*nonNLS*/)); + throw new IllegalArgumentException("conatiner cannot be null"); } IJavaElement[] elements= new IJavaElement[] {this}; IJavaElement[] containers= new IJavaElement[] {container}; @@ -104,7 +104,7 @@ */ public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException { if (container == null) { - throw new IllegalArgumentException(Util.bind("operation.nullContainer"/*nonNLS*/)); + throw new IllegalArgumentException("conatiner cannot be null"); } IJavaElement[] elements= new IJavaElement[] {this}; IJavaElement[] containers= new IJavaElement[] {container}; @@ -163,7 +163,7 @@ */ public void rename(String name, boolean force, IProgressMonitor monitor) throws JavaModelException { if (name == null) { - throw new IllegalArgumentException(Util.bind("element.nullName"/*nonNLS*/)); + throw new IllegalArgumentException("name cannot be null"); } IJavaElement[] elements= new IJavaElement[] {this}; IJavaElement[] dests= new IJavaElement[] {this.getParent()};
diff --git a/model/org/eclipse/jdt/internal/core/SourceType.java b/model/org/eclipse/jdt/internal/core/SourceType.java index 3fffc3f..b103373 100644 --- a/model/org/eclipse/jdt/internal/core/SourceType.java +++ b/model/org/eclipse/jdt/internal/core/SourceType.java
@@ -263,7 +263,7 @@ */ public ITypeHierarchy newTypeHierarchy(IJavaProject project, IProgressMonitor monitor) throws JavaModelException { if (project == null) { - throw new IllegalArgumentException(Util.bind("hierarchy.nullProject"/*nonNLS*/)); + throw new IllegalArgumentException("project argument cannot be null"); } CreateTypeHierarchyOperation op= new CreateTypeHierarchyOperation( @@ -317,17 +317,17 @@ protected void toStringInfo(int tab, StringBuffer buffer, Object info) { if (info == null) { buffer.append(this.getElementName()); - buffer.append(" (not open)"/*nonNLS*/); + buffer.append(" (not open)"); } else { try { if (this.isInterface()) { - buffer.append("interface "/*nonNLS*/); + buffer.append("interface "); } else { - buffer.append("class "/*nonNLS*/); + buffer.append("class "); } buffer.append(this.getElementName()); } catch (JavaModelException e) { - buffer.append("<JavaModelException in toString of "/*nonNLS*/ + getElementName()); + buffer.append("<JavaModelException in toString of " + getElementName()); } } }
diff --git a/model/org/eclipse/jdt/internal/core/TypeVector.java b/model/org/eclipse/jdt/internal/core/TypeVector.java index 11c3657..9c6cef0 100644 --- a/model/org/eclipse/jdt/internal/core/TypeVector.java +++ b/model/org/eclipse/jdt/internal/core/TypeVector.java
@@ -89,12 +89,12 @@ size = 0; } public String toString() { - StringBuffer buffer = new StringBuffer("["/*nonNLS*/); + StringBuffer buffer = new StringBuffer("["); for (int i = 0; i < size; i++) { - buffer.append("\n"/*nonNLS*/); + buffer.append("\n"); buffer.append(elements[i]); } - buffer.append("\n]"/*nonNLS*/); + buffer.append("\n]"); return buffer.toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/Util.java b/model/org/eclipse/jdt/internal/core/Util.java index 4c39fff..f30d888 100644 --- a/model/org/eclipse/jdt/internal/core/Util.java +++ b/model/org/eclipse/jdt/internal/core/Util.java
@@ -8,10 +8,6 @@ import java.io.*; -import java.util.MissingResourceException; -import java.util.Locale; -import java.util.ResourceBundle; - /** * Provides convenient utility methods to other types in this package. */ @@ -40,19 +36,13 @@ */ private static boolean JDK1_1 = false; - /* Bundle containing messages */ - protected static ResourceBundle bundle; - private final static String bundleName = "org.eclipse.jdt.internal.core.Messages"/*nonNLS*/; - - public final static char[] SUFFIX_class = ".class"/*nonNLS*/.toCharArray(); - public final static char[] SUFFIX_CLASS = ".CLASS"/*nonNLS*/.toCharArray(); - public final static char[] SUFFIX_java = ".java"/*nonNLS*/.toCharArray(); - public final static char[] SUFFIX_JAVA = ".JAVA"/*nonNLS*/.toCharArray(); - + private final static char[] SUFFIX_class = ".class".toCharArray(); + private final static char[] SUFFIX_CLASS = ".CLASS".toCharArray(); + private final static char[] SUFFIX_java = ".java".toCharArray(); + private final static char[] SUFFIX_JAVA = ".JAVA".toCharArray(); static { - String ver = System.getProperty("java.version"/*nonNLS*/); - JDK1_1 = ((ver != null) && ver.startsWith("1.1"/*nonNLS*/)); - relocalize(); + String ver = System.getProperty("java.version"); + JDK1_1 = ((ver != null) && ver.startsWith("1.1")); } /** * Checks the type signature in String sig, @@ -155,8 +145,8 @@ * @see concat(String, String) */ public static String concat(String s1, char c, String s2) { - if (s1 == null) s1 = "null"/*nonNLS*/; - if (s2 == null) s2 = "null"/*nonNLS*/; + if (s1 == null) s1 = "null"; + if (s2 == null) s2 = "null"; int l1 = s1.length(); int l2 = s2.length(); char[] buf = new char[l1 + 1 + l2]; @@ -176,8 +166,8 @@ * String constructor copies its argument, but there's no way around this. */ public static String concat(String s1, String s2) { - if (s1 == null) s1 = "null"/*nonNLS*/; - if (s2 == null) s2 = "null"/*nonNLS*/; + if (s1 == null) s1 = "null"; + if (s2 == null) s2 = "null"; int l1 = s1.length(); int l2 = s2.length(); char[] buf = new char[l1 + l2]; @@ -190,9 +180,9 @@ * @see concat(String, String) */ public static String concat(String s1, String s2, String s3) { - if (s1 == null) s1 = "null"/*nonNLS*/; - if (s2 == null) s2 = "null"/*nonNLS*/; - if (s3 == null) s3 = "null"/*nonNLS*/; + if (s1 == null) s1 = "null"; + if (s2 == null) s2 = "null"; + if (s3 == null) s3 = "null"; int l1 = s1.length(); int l2 = s2.length(); int l3 = s3.length(); @@ -759,75 +749,6 @@ Assert.isTrue(isValidTypeSignature(sig, allowVoid)); } -/** - * Lookup the message with the given ID in this catalog - */ -public static String bind(String id) { - return bind(id, (String[])null); -} - -/** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given string values. - */ -public static String bind(String id, String[] bindings) { - if (id == null) - return "No message available"/*nonNLS*/; - String message = null; - try { - message = bundle.getString(id); - } catch (MissingResourceException e) { - // If we got an exception looking for the message, fail gracefully by just returning - // the id we were looking for. In most cases this is semi-informative so is not too bad. - return "Missing message: "/*nonNLS*/ + id + " in: "/*nonNLS*/ + bundleName; - } - if (bindings == null) - return message; - int length = message.length(); - int start = -1; - int end = length; - StringBuffer output = new StringBuffer(80); - while (true) { - if ((end = message.indexOf('{', start)) > -1) { - output.append(message.substring(start + 1, end)); - if ((start = message.indexOf('}', end)) > -1) { - int index = -1; - try { - index = Integer.parseInt(message.substring(end + 1, start)); - output.append(bindings[index]); - } catch (NumberFormatException nfe) { - output.append(message.substring(end + 1, start + 1)); - } catch (ArrayIndexOutOfBoundsException e) { - output.append("{missing "/*nonNLS*/ + Integer.toString(index) + "}"/*nonNLS*/); - } - } else { - output.append(message.substring(end, length)); - break; - } - } else { - output.append(message.substring(start + 1, length)); - break; - } - } - return output.toString(); -} - -/** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given string. - */ -public static String bind(String id, String binding) { - return bind(id, new String[] {binding}); -} - -/** - * Lookup the message with the given ID in this catalog and bind its - * substitution locations with the given strings. - */ -public static String bind(String id, String binding1, String binding2) { - return bind(id, new String[] {binding1, binding2}); -} - /** * Returns true iff str.toLowerCase().endsWith(end.toLowerCase()) * implementation is not creating extra strings. @@ -884,11 +805,4 @@ } return true; } - -/** - * Creates a NLS catalog for the given locale. - */ -public static void relocalize() { - bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault()); -} }
diff --git a/model/org/eclipse/jdt/internal/core/WorkingCopy.java b/model/org/eclipse/jdt/internal/core/WorkingCopy.java index d2dde90..f69650e 100644 --- a/model/org/eclipse/jdt/internal/core/WorkingCopy.java +++ b/model/org/eclipse/jdt/internal/core/WorkingCopy.java
@@ -306,7 +306,7 @@ */ protected void toString(int tab, StringBuffer buffer) { buffer.append(this.tabString(tab)); - buffer.append("(working copy)\n"/*nonNLS*/); + buffer.append("(working copy)\n"); super.toString(tab, buffer); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/BuildEvent.java b/model/org/eclipse/jdt/internal/core/builder/BuildEvent.java index 54b687e..87c981d 100644 --- a/model/org/eclipse/jdt/internal/core/builder/BuildEvent.java +++ b/model/org/eclipse/jdt/internal/core/builder/BuildEvent.java
@@ -1,13 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A BuildEvent encapsulates information passed to an IBuildListener. - */ public class BuildEvent { protected ISourceFragment fSourceFragment; protected int fNewErrorCount;
diff --git a/model/org/eclipse/jdt/internal/core/builder/DeltaKey.java b/model/org/eclipse/jdt/internal/core/builder/DeltaKey.java index 4810cf9..206cd47 100644 --- a/model/org/eclipse/jdt/internal/core/builder/DeltaKey.java +++ b/model/org/eclipse/jdt/internal/core/builder/DeltaKey.java
@@ -340,15 +340,15 @@ public String toString () { StringBuffer buffer = new StringBuffer(); - buffer.append("DeltaKey("/*nonNLS*/); + buffer.append("DeltaKey("); for (int i = 0; i < this.fLocalNames.length; i++) { buffer.append(this.fLocalNames[i]); if (i < this.fLocalNames.length - 1) { - buffer.append("/"/*nonNLS*/); + buffer.append("/"); } } - buffer.append(")"/*nonNLS*/); + buffer.append(")"); return buffer.toString(); }
diff --git a/model/org/eclipse/jdt/internal/core/builder/IBuildMonitor.java b/model/org/eclipse/jdt/internal/core/builder/IBuildMonitor.java index b79e3d6..652126f 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IBuildMonitor.java +++ b/model/org/eclipse/jdt/internal/core/builder/IBuildMonitor.java
@@ -1,15 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A build monitor tracks what compilation units have been compiled during a - * given build. This allows test suites to evaluate the efficiency of incremental - * compilation. - */ public interface IBuildMonitor { /** * Signals that a new build has begun
diff --git a/model/org/eclipse/jdt/internal/core/builder/IConstructor.java b/model/org/eclipse/jdt/internal/core/builder/IConstructor.java index 04abc2d..341de55 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IConstructor.java +++ b/model/org/eclipse/jdt/internal/core/builder/IConstructor.java
@@ -1,25 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * Constructor provides information about a single - * constructor for a class. - * - * Changes from java.lang and java.lang.reflect: - * <ul> - * <li>toString() changed to be a handle-only method; - * it ignores the modifiers and exceptions.</li> - * </ul> - * - * @see IMember - * @see IType - * @see IType#getConstructorHandle - * @see IType#getDeclaredConstructors - */ public interface IConstructor extends IMember { @@ -37,7 +17,7 @@ /** * Returns an array of Type objects that represent the types of * the checked exceptions thrown by the underlying constructor - * represented by this Constructor object. + * represented by this Constructor object. * Unchecked exceptions are not included in the result, even if * they are declared in the source. * Returns an array of length 0 if the constructor throws no checked @@ -50,7 +30,7 @@ /** * Returns an array of Type objects that represent the formal * parameter types, in declaration order, of the constructor - * represented by this Constructor object. + * represented by this Constructor object. * Returns an array of length 0 if the underlying constructor * takes no parameters. * This is a handle-only method. @@ -76,7 +56,7 @@ * followed by a parenthesized, comma-separated list of the * constructor's formal parameter types. For example: * <pre> - * java.util.Hashtable(int,float) + * java.util.Hashtable(int,float) * </pre> * * @see IHandle#toString
diff --git a/model/org/eclipse/jdt/internal/core/builder/IDeltaKey.java b/model/org/eclipse/jdt/internal/core/builder/IDeltaKey.java index a8543cd..8118823 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IDeltaKey.java +++ b/model/org/eclipse/jdt/internal/core/builder/IDeltaKey.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public interface IDeltaKey { /** @@ -34,16 +29,16 @@ * Returns the key describing the receiver's parent, or null if the receiver * is the root key. */ - DeltaKey parent(); + DeltaKey parent(); /** * Returns a new key containing the first few local names in the * receiver. * * @param count - * number of local names to copy (length of prefix) + * number of local names to copy (length of prefix) * @exception IllegalArgumentException - * receiver contains fewer than count local names, or count is - * negative." + * receiver contains fewer than count local names, or count is + * negative." */ DeltaKey prefix (int count); /** @@ -55,10 +50,10 @@ * names in the receiver. * * @param count - * number of local names in the key to leave out (length of prefix to cut) + * number of local names in the key to leave out (length of prefix to cut) * @exception IllegalArgumentException - * receiver contains fewer than count local names, or count is - * negative. + * receiver contains fewer than count local names, or count is + * negative. */ DeltaKey withoutPrefix (int count); }
diff --git a/model/org/eclipse/jdt/internal/core/builder/IDependencyGraph.java b/model/org/eclipse/jdt/internal/core/builder/IDependencyGraph.java index 002e5b6..acf201b 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IDependencyGraph.java +++ b/model/org/eclipse/jdt/internal/core/builder/IDependencyGraph.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The dependency graph describes the dependencies between elements in a given state. - * It is navigated using non-state-specific class or interface handles. - */ public interface IDependencyGraph { /** * Returns the namespaces on which the given type depends.
diff --git a/model/org/eclipse/jdt/internal/core/builder/IField.java b/model/org/eclipse/jdt/internal/core/builder/IField.java index e4c8401..763e943 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IField.java +++ b/model/org/eclipse/jdt/internal/core/builder/IField.java
@@ -1,28 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A Field provides information about a - * single field of a class or an interface. The field may - * be a class (static) field or an instance field. - * - * Changes from java.lang and java.lang.reflect: - * <ul> - * <li>equals(Object) changed to ignore field type - * (field type is not an identity criterion for field handles).</li> - * <li>toString() changed to be a handle-only method; - * it ignores the modifiers and field type.</li> - * </ul> - * - * @see IMember - * @see IType - * @see IType#getFieldHandle - * @see IType#getDeclaredFields - */ public interface IField extends IMember { @@ -61,8 +38,8 @@ * followed by a period, followed by the name of the field. * For example: * <pre> - * java.lang.Thread.MIN_PRIORITY - * java.io.FileDescriptor.fd + * java.lang.Thread.MIN_PRIORITY + * java.io.FileDescriptor.fd * </pre> * * @see IHandle#toString
diff --git a/model/org/eclipse/jdt/internal/core/builder/IHandle.java b/model/org/eclipse/jdt/internal/core/builder/IHandle.java index a4233f5..a341e51 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IHandle.java +++ b/model/org/eclipse/jdt/internal/core/builder/IHandle.java
@@ -1,95 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The <code>IHandle</code> defines messages common to objects - * in the image (for Java, these would be things such as packages, types, - * methods, and fields). - * Each one of these has an identifying handle, which represents the object. - * There can only be at most one such object in the image. - * <p> - * Handles come in two flavours: state-specific, and non-state-specific. - * A state-specific handle is tied to a specific state and refers to an - * object in that state. The state of a state-specific handle cannot - * be changed. - * A non-state-specific handle is not tied to a specific state and refers - * to an object in whichever state is the current state of the development context. - * The current state may change, in which case all non-state-specific handles - * now refer to the object in the new current state. - * Normally a client is dealing with non state-specific handles, occasionally with - * state-specific handles, and very rarely with a combination of the two. - * <p> - * It is possible for the object refered to by a handle to be - * missing from the image (e.g. a class which was deleted). - * The isPresent() method can be used to determine whether the object - * is present in a state of the development context or not. - * For state-specific handles, isPresent() returns true if and only if the - * object is present in the state the handle is tied to. - * For non-state-specific handles, isPresent() returns true if and only if - * the object is present in the current state of the DC. - * <p> - * Certain methods on handles require that the object it represents be present - * (these are called 'non-handle-only methods'), whereas others operate only on - * the handles themselves and will work correctly whether or not the object - * is present (these are called 'handle-only methods'). - * If a non-handle-only method is invoked on a handle whose object is not present, - * a <code>NotPresentException</code> is thrown (except for the isPresent() method). - * <p> - * The development context tries to ensure that any objects obtained by navigating - * from a present object are also present. For example, in Java, the classes - * returned by Package.getAllClasses() will all be present. - * For cases where an object referenced in the source is not present in the image, - * the image builder either creates a <em>fictional</em> object to take its place or makes - * it appear as if the reference never existed. - * These fictional objects are considered to be present (although it is not generally - * true that if an object is fictional then it is present). - * For example, if a class B subclasses a class A, and B is present in the image - * but A is not, then the image builder could invent a fictional class A. So the - * navigation B.getSuperclass() would result in an object that is present. - * For this reason, NotPresentException is an unchecked RuntimeException, to allow - * clients to operate under the assumption that all reachable objects are present. - * Special care must be taken when creating handles - * (i.e. <code>Package.getClassHandle(String)</type), since the objects - * referred to may not be present. Other methods where this assumption does not - * hold are explicitly marked (e.g. <code>Package.getReferencedPackages()</code>). - * <p> - * The following table defines the identity criteria for the principle kinds - * of Java handles. For two handles to be considered the same, they must satisfy - * these criteria. In addition, the handles must either both be non-state-specific, - * or both be state-specific on the same state. - * <p> - * <dl> - * <b><dt>Kind of handle</dt> <dd>Identity criteria</dd></b> - * <dt>Image</dt> <dd>Same development context.</dd> - * <dt>Package</dt> <dd>Same development context, same package name.</dd> - * <dt>Type</dt> - * <dd>Same development context. - * For classes and interfaces, same type name (same fully qualified name, - * excluding package name) and same containing package. - * For array types, same component type. - * For primitive types, same primitive type name.</dd> - * <dt>Field</dt> <dd>Same development context, same declaring type, same field name.</dd> - * <dt>Method</dt> - * <dd>Same development context, same declaring type, same method name, - * same argument types.</dd> - * <dt>Constructor</dt> - * <dd>Same development context, same declaring type, same argument types.</dd> - * </dl> - * - * @see IImage - * @see IPackage - * @see IType - * @see IField - * @see IMethod - * @see IConstructor - * @see INotPresentException - * - * @see #equals - */ public interface IHandle { int K_JAVA_IMAGE = 1; @@ -137,7 +47,7 @@ /** * Returns a state-specific object which refers to the same object * as this object, but restricted to the given state. This object - * must be non-state-specific. + * must be non-state-specific. * It is an error to invoke this on a state-specific object. * This is a handle-only method; the object may or may not be present * in the given state. @@ -189,7 +99,7 @@ */ IHandle nonStateSpecific() throws StateSpecificException; /** - * Return a string describing this handle. + * Return a string describing this handle. * This is a handle-only method. * Extending interfaces provide more details. *
diff --git a/model/org/eclipse/jdt/internal/core/builder/IImageBuilder.java b/model/org/eclipse/jdt/internal/core/builder/IImageBuilder.java index ffe56bc..6192f06 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IImageBuilder.java +++ b/model/org/eclipse/jdt/internal/core/builder/IImageBuilder.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * An ImageBuilder represents the process of building - * a state. It can be queried for the State being built. - * If the state is being built incrementally as a change to - * a previous state, this object can be queried for the - * image delta between the old state and the new state. - */ public interface IImageBuilder { @@ -45,12 +33,12 @@ IState getOldState(); /** * Return a string of the form: - * batch image builder for: - * new state: this.data.newstate + * batch image builder for: + * new state: this.data.newstate * OR - * incremental image builder for: - * new state: this.data.newstate - * old state: this.data.oldstate + * incremental image builder for: + * new state: this.data.newstate + * old state: this.data.oldstate * Obviously, which string gets returned depends * on the type of image builder. * The string returned is only for debugging purposes,
diff --git a/model/org/eclipse/jdt/internal/core/builder/IImageContext.java b/model/org/eclipse/jdt/internal/core/builder/IImageContext.java index 9324d64..90deeba 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IImageContext.java +++ b/model/org/eclipse/jdt/internal/core/builder/IImageContext.java
@@ -1,27 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The <code>IImageContext</code> represents a subset of - * a Java image. ImageContext objects are used in queries, such as - * getSubclasses(), which require more context than just the local - * definition of a class. This is to allow the Image to contain - * a very large (conceptually infinite) number of packages, without - * forcing them all to be considered when performing such non-local - * queries. - * - * <p>For now, an ImageContext is defined as a set of non-state-specific packages. - * The ImageContext itself is conceptually non-state-specific. - * - * @see IImage#createImageContext - * @see IImage#getPackages - * @see IImage#getAllClasses - * @see IType#getSubclasses - */ public interface IImageContext { @@ -38,12 +16,12 @@ IPackage[] getPackages(); /** * Return a string of the form: - * image context with packages: - * this.data.package[0] - * this.data.package[1] - * ... - * this.data.package[n-1] - * + * image context with packages: + * this.data.package[0] + * this.data.package[1] + * ... + * this.data.package[n-1] + * * The string returned is only for debugging purposes, * and the contents of the string may change in the future. * @return java.lang.String
diff --git a/model/org/eclipse/jdt/internal/core/builder/IMember.java b/model/org/eclipse/jdt/internal/core/builder/IMember.java index 41d9055..39401fe 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IMember.java +++ b/model/org/eclipse/jdt/internal/core/builder/IMember.java
@@ -1,19 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * Member is a mixin interface that represents identifying information about - * a single member (a field or method), a constructor, or a nested class. - * - * @see IType - * @see IField - * @see IMethod - * @see IConstructor - */ public interface IMember extends IHandle { @@ -48,8 +34,8 @@ * A binary member is one for which the declaring class is in * .class file format in the workspace. * - * @return <code>true</code> if this object represents a binary member; - * <code>false</code> otherwise. + * @return <code>true</code> if this object represents a binary member; + * <code>false</code> otherwise. * @exception NotPresentException if this type is not present. */ boolean isBinary() throws NotPresentException; @@ -59,8 +45,8 @@ * A deprecated object is one that has a 'deprecated' tag in * its doc comment. * - * @return <code>true</code> if this object represents a deprecated member; - * <code>false</code> otherwise. + * @return <code>true</code> if this object represents a deprecated member; + * <code>false</code> otherwise. * @exception NotPresentException if this type is not present. */ boolean isDeprecated() throws NotPresentException;
diff --git a/model/org/eclipse/jdt/internal/core/builder/IMethod.java b/model/org/eclipse/jdt/internal/core/builder/IMethod.java index b6eeafe..2de8e6e 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IMethod.java +++ b/model/org/eclipse/jdt/internal/core/builder/IMethod.java
@@ -1,26 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A Method provides information about a single method - * on a class or interface. The method may be a class method - * or an instance method (including an abstract method). - * - * Changes from java.lang and java.lang.reflect: - * <ul> - * <li>toString() changed to be a handle-only method; - * it ignores the modifiers, return type, and exceptions.</li> - * </ul> - * - * @see IMember - * @see IType - * @see IType#getMethodHandle - * @see IType#getDeclaredMethods() - */ public interface IMethod extends IMember { @@ -79,7 +58,7 @@ */ boolean isPresent(); /** - * Returns a string describing this Method handle. The string is + * Returns a string describing this Method handle. The string is * formatted as the fully qualified name of the declaring class, * followed by a period, followed by the method name, * followed by a parenthesized, comma-separated list of the method's
diff --git a/model/org/eclipse/jdt/internal/core/builder/IPackage.java b/model/org/eclipse/jdt/internal/core/builder/IPackage.java index 3cfc9d3..6b98250 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IPackage.java +++ b/model/org/eclipse/jdt/internal/core/builder/IPackage.java
@@ -1,13 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The <code>IPackage</code> represents a package. - */ public interface IPackage extends IHandle { @@ -66,8 +58,8 @@ * string of this unnamed packaged. * This is a handle-only method. * - * @return the fully qualified name of the package - * represented by this object. + * @return the fully qualified name of the package + * represented by this object. */ String getName(); /** @@ -96,7 +88,7 @@ * * @exception NotPresentException if this package is not present. */ - IPackage[] getReferencedPackages() throws NotPresentException; + IPackage[] getReferencedPackages() throws NotPresentException; /** * Returns an array of Package objects representing all packages * in the given image context which directly reference this package.
diff --git a/model/org/eclipse/jdt/internal/core/builder/IProblemDetail.java b/model/org/eclipse/jdt/internal/core/builder/IProblemDetail.java index e87937f..fd1d212 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IProblemDetail.java +++ b/model/org/eclipse/jdt/internal/core/builder/IProblemDetail.java
@@ -1,16 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * <code>IProblemDetail</code> provides details about a problem - * with the image. - * - * @see IState#getReportCard(IImageContext) - */ public interface IProblemDetail { /**
diff --git a/model/org/eclipse/jdt/internal/core/builder/ISearch.java b/model/org/eclipse/jdt/internal/core/builder/ISearch.java index 68da8e8..353f64c 100644 --- a/model/org/eclipse/jdt/internal/core/builder/ISearch.java +++ b/model/org/eclipse/jdt/internal/core/builder/ISearch.java
@@ -1,31 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * An <code>ISearch</code> represents an image search and its results. - * <code>ISearch</code>es are created by <code>ISearchFactory</code> objects. - * They can be queried for results and report progress as the search runs. A - * search can be stopped before it finishes and can be run again. - * <code>ISearch</code> is implemented in a thread safe manner. - * <p> - * The search is not precise. Instead it provides a best-effort search. - * No occurrences of what is being searched for will be missed, and no duplicate - * results will be returned. However, the search may occasionally return additional - * matches which don't actually relate to what was being searched for. - * This will only be an issue when searching for source references. An - * example of this would be if a search for references to a field called <code>io</code> was - * performed. Any methods which contained a reference to <code>java.io.</code><i>something</i> - * would be returned as matches, because in the source, it is unclear whether - * <code>io</code> is a field in some class called <code>java</code> or not. - * <p> - * ISearchFactory shows examples of using ISearch. - * - * @see ISearchFactory - */ public interface ISearch extends Runnable { /** @@ -33,11 +7,11 @@ * from this search. Progress events occur as a search examines the types * and packages in the search scope. Result events occur as a search finds * matches to the search criteria. - * @param listener the search listener - * @see ISearchListener - * @see SearchProgressEvent - * @see SearchResultEvent - * @see ISearch#removeSearchListener + * @param listener the search listener + * @see ISearchListener + * @see SearchProgressEvent + * @see SearchResultEvent + * @see ISearch#removeSearchListener */ void addSearchListener(ISearchListener listener); /** @@ -52,9 +26,9 @@ * <ul> * <li> neither is equal to null AND * <li> both searches have the same kind (i.e.. search for type), name - * (i.e., type named 'Foo') return type, number and type of parameters - * (even if not used -- as in the case of search for type), and search - * context (i.e., ISearchFactory.SEARCH_FOR_DECLS) + * (i.e., type named 'Foo') return type, number and type of parameters + * (even if not used -- as in the case of search for type), and search + * context (i.e., ISearchFactory.SEARCH_FOR_DECLS) * <li> their scopes are equal (contain the same IPackage and IType handles, in any order) * </ul> */ @@ -83,11 +57,11 @@ /** * Removes the specified action listener so that it no longer * receives progress and result events from the search. - * @param listener the search listener - * @see ISearchListener - * @see SearchProgressEvent - * @see SearchResultEvent - * @see ISearch#addSearchListener + * @param listener the search listener + * @see ISearchListener + * @see SearchProgressEvent + * @see SearchResultEvent + * @see ISearch#addSearchListener */ void removeSearchListener(ISearchListener listener); /**
diff --git a/model/org/eclipse/jdt/internal/core/builder/ISearchFactory.java b/model/org/eclipse/jdt/internal/core/builder/ISearchFactory.java index 3df5910..217f472 100644 --- a/model/org/eclipse/jdt/internal/core/builder/ISearchFactory.java +++ b/model/org/eclipse/jdt/internal/core/builder/ISearchFactory.java
@@ -1,62 +1,7 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * <code>ISearchFactory</code> creates <code>ISearch</code> objects which can - * search some subset of the image. These <code>ISearch</code> objects can - * be configured with a name, a scope, and a search context. - * <p> - * <ul> - * <li><b>Name:</b> - * The name of the search specifies what the search is actually looking for. - * It can be the name of a type, a field, a package, a method, or a constructor. - * Searches for methods and constructors may also supply parameter and return - * type information. Wildcarding is supported. - * <li><b>Scope:</b> - * The scope of the search defines the subset of the image that is to be searched. - * Including a type in the scope includes all inner types, fields, methods and - * constructors of that type in the search. Inner types also have all of their - * inner types, fields, methods and constructors included in the scope of the - * search, recursively. Including a package in the scope includes all types contained - * in the package in the scope and, therefore, all inner types, fields, methods and - * constructors. The items in the scope must belong to the same state as the - * image from which this search engine was obtained. Results of the search will also - * be in the same state as the image. If the image is non-state-specific, the - * items in the scope must be non-state-specific as well. Furthermore, results - * found by the search will also be non-state-specific. - * <li><b>Context:</b> - * The search context is defined using flags which specify whether the search is - * looking for declarations or references. Furthermore, when looking for - * references, the search can look either in the principle structure or the - * source of each type in the search scope. The flags can be 'OR'ed - * together to allow searches for declarations and references. - * </ul> - * <p> - * <b>Example:</b><br> - * Search for all references to a type named "String" in the scope of the - * package "hanoiExample". Wait for the results, and then print them out. - * <pre><code> - * IImage image = dc.getImage(); - * ISearchFactory sf = image.newSearchFactory(); - * IHandle[] scope = {image.getPackageHandle("hanoiExample", false)}; - * ISearch search = - * sf.searchForType( - * "String", - * scope, - * ISearchFactory.SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS | - * ISearchFactory.SEARCH_FOR_SOURCE_REFS); - * search.run(); // perform the search - * for (int i = 0; i < search.getItemCount(); i++) - * System.out.println(search.getItem(i)); - * </code></pre> - * @see ISearch - */ public interface ISearchFactory -{ +{ /* Flags for search context */ /** @@ -90,26 +35,26 @@ * name. * <p> * <b>Example:</b> Searching for declarations of fields named <code>width</code> - * in package <code>java.awt</code>. + * in package <code>java.awt</code>. * <pre><code> * IImage image = dc.getImage(); * ISearchFactory sf = image.newSearchFactory(); * IHandle[] scope = {image.getPackageHandle("java.awt", false)}; * ISearch search = - * sf.searchForField( - * "width", - * scope, - * ISearchFactory.SEARCH_FOR_DECLS); + * sf.searchForField( + * "width", + * scope, + * ISearchFactory.SEARCH_FOR_DECLS); * search.run(); * </code></pre> * @param fieldName the name of the field to search for, possibly containing - * wildcards ("*") + * wildcards ("*") * @param scope the packages and types to search in * @param context the context flags. SEARCH_FOR_DECLS, and - * SEARCH_FOR_SOURCE_REFS are valid flags for field searches. - * SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will not have any effect on - * the search because there are no field references in the principle - * structure. + * SEARCH_FOR_SOURCE_REFS are valid flags for field searches. + * SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will not have any effect on + * the search because there are no field references in the principle + * structure. * * * @see ISearch @@ -127,34 +72,34 @@ * <b>Example:</b> Search for declarations of methods named <code>toString</code> * whose second argument is <code>int</code>. The search will be conducted * in the scope of the <code>hanoiExample</code> package. - * <code><pre> + * <code><pre> * IImage image = dc.getImage(); * ISearchFactory factory = image.newSearchFactory(); * IHandle[] scope = {image.getPackageHandle("hanoiExample")}; * ISearch search = - * factory.searchForMethod( - * "toString", - * new String[] {"*", "int"}, - * "*", - * scope, - * SEARCH_FOR_DECLS); + * factory.searchForMethod( + * "toString", + * new String[] {"*", "int"}, + * "*", + * scope, + * SEARCH_FOR_DECLS); * search.run(); - * </code></pre> + * </code></pre> * <br> * @param methodName the method name to search for, possibly containing wildcards ("*") * @param paramTypes the names of parameter types the method being searched for must - * have, possibly containing wildcards. An empty array indicates a method with - * zero parameters. + * have, possibly containing wildcards. An empty array indicates a method with + * zero parameters. * @param returnType the name of the return type the method being - * searched for must have, possibly containing wildcards. A return type - * of "*" effectively ignores the return type. + * searched for must have, possibly containing wildcards. A return type + * of "*" effectively ignores the return type. * @param scope the packages and types to search in * @param context the context flags. SEARCH_FOR_DECLS make sense as a flag for - * this method search. Using SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will have no effect since methods - * cannot be referenced in the principle structure. When searching the source, - * SEARCH_FOR_SOURCE_REFS will ignore the return type, and only use the - * number of parameters, not the parameter types. This is because at the source - * level only the method name and number of parameters are + * this method search. Using SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will have no effect since methods + * cannot be referenced in the principle structure. When searching the source, + * SEARCH_FOR_SOURCE_REFS will ignore the return type, and only use the + * number of parameters, not the parameter types. This is because at the source + * level only the method name and number of parameters are * known. * @see ISearch */ @@ -175,50 +120,50 @@ * which have 2 arguments. The search will be conducted in the scope of the <code>hanoiExample</code> * package. Note that the principle structure is not searched for references * since it never contains information about references to methods. - * <code><pre> + * <code><pre> * IImage image = dc.getImage(); * ISearchFactory factory = image.newSearchFactory(); * IHandle[] scope = {image.getPackageHandle("hanoiExample")}; * ISearch search = - * factory.searchForMethod( - * "add", - * 2, - * "*", - * scope, - * SEARCH_FOR_DECLS | - * SEARCH_FOR_SOURCE_REFS); + * factory.searchForMethod( + * "add", + * 2, + * "*", + * scope, + * SEARCH_FOR_DECLS | + * SEARCH_FOR_SOURCE_REFS); * search.run(); - * </code></pre> + * </code></pre> * <br> * <b>Example 2:</b> Search for references to a constructor for a class named * <code>Disk</code> which takes any number of arguments. The search will be conducted in * the scope of the <code>hanoiExample</code> package. Note that the principle structure is not searched for references * since it never contains information about references to methods. - * <code><pre> + * <code><pre> * IImage image = dc.getImage(); * ISearchFactory factory = image.newSearchFactory(); * IHandle[] scope = {image.getPackageHandle("hanoiExample")}; * ISearch search = - * factory.searchForMethod( - * "Disk", - * -1, - * "", // return type ignored for constructors - * scope, - * SEARCH_FOR_SOURCE_REFS); + * factory.searchForMethod( + * "Disk", + * -1, + * "", // return type ignored for constructors + * scope, + * SEARCH_FOR_SOURCE_REFS); * search.run(); - * </code></pre> + * </code></pre> * * @param methodName the method name to search for, possibly containing wildcards ("*") * @param parameterCount the number of parameters the method being - * searched for has. Use -1 if number of parameters doesn't matter + * searched for has. Use -1 if number of parameters doesn't matter * @param returnType the name of the return type the method being - * searched for must have, possibly containing wildcards. A return type of - * "*" effectively ignores return type. + * searched for must have, possibly containing wildcards. A return type of + * "*" effectively ignores return type. * @param scope the packages and types to search in * @param context the context flags. SEARCH_FOR_DECLS and - * SEARCH_FOR_SOURCE_REFS make sense as flags for this method search. - * SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will not have any effect since - * principle structures cannot reference methods. + * SEARCH_FOR_SOURCE_REFS make sense as flags for this method search. + * SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will not have any effect since + * principle structures cannot reference methods. * * @see ISearch */ @@ -241,21 +186,21 @@ * ISearchFactory sf = image.newSearchFactory(); * IHandle[] scope = {image.getPackageHandle("hanoiExample", false)}; * ISearch search = - * sf.searchForPackage( - * "java.aw*", - * scope, - * ISearchFactory.SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS | - * ISearchFactory.SEARCH_FOR_SOURCE_REFS); + * sf.searchForPackage( + * "java.aw*", + * scope, + * ISearchFactory.SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS | + * ISearchFactory.SEARCH_FOR_SOURCE_REFS); * search.run(); * </code></pre> * * @param packageName the name of the package to search for, possibly - * containing wildcards ("*") + * containing wildcards ("*") * @param scope the packages and types to search in * @param context the context flags. SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS, - * and SEARCH_FOR_SOURCE_REFS make sense as flags for package - * searches. Using SEARCH_FOR_DECLS will not have any effect because - * packages are not declared anywhere. + * and SEARCH_FOR_SOURCE_REFS make sense as flags for package + * searches. Using SEARCH_FOR_DECLS will not have any effect because + * packages are not declared anywhere. * * @see ISearch */ @@ -275,17 +220,17 @@ * ISearchFactory sf = image.newSearchFactory(); * IHandle[] scope = {image.getPackageHandle("hanoiExample", false)}; * ISearch search = - * sf.searchForType( - * "Post", - * scope, - * ISearchFactory.SEARCH_FOR_DECLS); + * sf.searchForType( + * "Post", + * scope, + * ISearchFactory.SEARCH_FOR_DECLS); * search.run(); * </code></pre> * @param typeName the simple name of the type to search for, possibly - * containing wildcards ("*") + * containing wildcards ("*") * @param scope the packages and types to search in * @param context the context flags. SEARCH_FOR_DECLS, SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS, - * and SEARCH_FOR_SOURCE_REFS all make sense as flags for type searches. + * and SEARCH_FOR_SOURCE_REFS all make sense as flags for type searches. * * @see ISearch */
diff --git a/model/org/eclipse/jdt/internal/core/builder/ISearchListener.java b/model/org/eclipse/jdt/internal/core/builder/ISearchListener.java index c37af37..d4031d2 100644 --- a/model/org/eclipse/jdt/internal/core/builder/ISearchListener.java +++ b/model/org/eclipse/jdt/internal/core/builder/ISearchListener.java
@@ -1,16 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The event listener interface for receiving progress and result updates - * from an <code>ISearch</code>. - * - * @see ISearch - */ public interface ISearchListener extends java.util.EventListener { /** * Reports that the search has been cancelled and is no longer running.
diff --git a/model/org/eclipse/jdt/internal/core/builder/IType.java b/model/org/eclipse/jdt/internal/core/builder/IType.java index 7cbe537..2603694 100644 --- a/model/org/eclipse/jdt/internal/core/builder/IType.java +++ b/model/org/eclipse/jdt/internal/core/builder/IType.java
@@ -1,64 +1,10 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The <code>Type</code> interface represents classes, interfaces, array - * types, the primitive Java types (boolean, byte, char, short, int, - * long, float, and double) and the keyword void. - * - * <p>This interface is based on the <code>java.lang.Class</code> class in JDK 1.1. - * - * <p>The following terminology is used for inner classes, and applies also - * to interfaces. - * This terminology is consistent with the Java Inner Classes Specification. - * - * <p>A 'package member' class is declared as a member of a package. - * That is, a 'normal' class, as defined in the <em>Java Language Specification</em>. - * - * <p>An 'inner class' is one which is declared in another class, either as a member - * of that class or within a method or other block within that class. - * The class in which an inner class is declared is referred to as its 'outer class'. - * An inner class must be instantiated in the context of an instance of its outer class. - * The instance of the outer class is referred to as the 'outer instance'. - * - * <p>A 'top-level class' is declared either as a package member or as a - * static member of another top-level class. A top-level class can be referred to - * by a fully qualified name (given the right access), and is instanciated - * directly; it is not instanciated in the context of an outer instance. - * A class can be either a top-level class or an inner class, but cannot be both. - * - * <p>A 'nested class' is one which is not a package member: either an - * inner class, or a top-level class declared as a member of a class. - * - * <p>A 'local class' is an inner class declared within a method or other block - * within its outer class. Since a local class is a kind of inner class, - * it cannot be a top-level class. - * - * <p>An 'anonymous class' is a local inner class with no declared name. - * - * Changes from java.lang and java.lang.reflect: - * <ul> - * <li>renamed to Type from Class - * <li>toString() clarified for array types</li> - * <li>major additions (see below)</li> - * <li>removed isAssignableFrom(Type)</li> - * <li>removed getFields()</li> - * <li>removed getMethods()</li> - * <li>removed getConstructors()</li> - * <li>removed getField(String), getMethod(String, Type[]), getConstructor(Type[])</li> - * <li>removed getDeclaredField(String), getDeclaredMethod(String, Type[]), getDeclaredConstructor(Type[])</li> - * <li>added handle methods getFieldHandle(String) etc.</li> - * </ul> - */ public interface IType extends IMember { /** - * Compares this Type handle against the specified object. Returns + * Compares this Type handle against the specified object. Returns * true if the objects are the same. Two Types handles are the same if * they both represent a class or interface and have the same fully qualified name, * or if they both represent the same primitive type, @@ -97,7 +43,7 @@ * This is a handle-only method; the specified constructor may * or may not actually be present in the class or interface. * - * @see IConstructor + * @see IConstructor */ IConstructor getConstructorHandle(IType[] parameterTypes); /** @@ -209,8 +155,8 @@ * If this does not represent a class or interface, it returns * a String of length 0. * - * @return the declared name of the class or interface - * represented by this object. + * @return the declared name of the class or interface + * represented by this object. * @exception NotPresentException if this class or interface is not present. */ String getDeclaredName() throws NotPresentException; @@ -255,7 +201,7 @@ * Returns an array of length 0 if this object does not represent * an interface. * The resulting Types are in no particular order. - * See <em>The Java Language Specification</em> section 8.1.4 + * See <em>The Java Language Specification</em> section 8.1.4 * for more details. * * @param imageContext the ImageContext in which to restrict the search. @@ -282,10 +228,10 @@ * object represents neither a class nor an interface, this method * returns an array of length 0. * - * See <em>The Java Language Specification</em> sections 8.1.4 and 9.1.3 + * See <em>The Java Language Specification</em> sections 8.1.4 and 9.1.3 * for more details. * - * @return an array of interfaces implemented by this class. + * @return an array of interfaces implemented by this class. * @exception NotPresentException if this class or interface is not present. */ IType[] getInterfaces() throws NotPresentException; @@ -300,7 +246,7 @@ * This is a handle-only method; the specified method may * or may not actually be present in the class or interface. * - * @see IMethod + * @see IMethod */ IMethod getMethodHandle(String name, IType[] parameterTypes); /** @@ -335,7 +281,7 @@ * For primitive types, the name is the keyword for the primitive type. * This is a handle-only method. * - * @return the fully qualified name of the type represented by this object. + * @return the fully qualified name of the type represented by this object. */ String getName(); /** @@ -353,7 +299,7 @@ * For primitive types, this is the keyword for the primitive type. * This is a handle-only method. * - * @return the simple name of the type represented by this object. + * @return the simple name of the type represented by this object. */ String getSimpleName(); /** @@ -373,7 +319,7 @@ * Returns an array of length 0 if this object does not represent * a class. * The resulting Types are in no particular order. - * See <em>The Java Language Specification</em> sections 8.1.3 and 20.3.4 + * See <em>The Java Language Specification</em> sections 8.1.3 and 20.3.4 * for more details. * * @param imageContext the ImageContext in which to restrict the search. @@ -387,7 +333,7 @@ * Returns an array of length 0 if this object does not represent * an interface. * The resulting Types are in no particular order. - * See <em>The Java Language Specification</em> section 9.1.3 + * See <em>The Java Language Specification</em> section 9.1.3 * for more details. * * @param imageContext the ImageContext in which to restrict the search. @@ -405,10 +351,10 @@ * If this object represents an array type, then the Type that represents * class <code>java.lang.Object</code> is returned. * <p> - * See <em>The Java Language Specification</em> sections 8.1.3 and 20.3.4 + * See <em>The Java Language Specification</em> sections 8.1.3 and 20.3.4 * for more details. * - * @return the superclass of the class represented by this object. + * @return the superclass of the class represented by this object. * @exception NotPresentException if this type is not present. */ IType getSuperclass() throws NotPresentException; @@ -440,8 +386,8 @@ * A binary type is one which is in .class file format in the workspace. * Returns <code>false</code> if this represents a primitive type or an array type. * - * @return <code>true</code> if this object represents a binary class or interface; - * <code>false</code> otherwise. + * @return <code>true</code> if this object represents a binary class or interface; + * <code>false</code> otherwise. * @exception NotPresentException if this type is not present. */ boolean isBinary() throws NotPresentException; @@ -450,8 +396,8 @@ * This returns false if this object represents an interface, * an array type, or a primitive type. * - * @return <code>true</code> if this object represents a class; - * <code>false</code> otherwise. + * @return <code>true</code> if this object represents a class; + * <code>false</code> otherwise. * @exception NotPresentException if this type is not present. * * @see #isArray @@ -466,8 +412,8 @@ * its doc comment. * Returns <code>false</code> if this represents a primitive type or an array type. * - * @return <code>true</code> if this object represents a deprecated member; - * <code>false</code> otherwise. + * @return <code>true</code> if this object represents a deprecated member; + * <code>false</code> otherwise. * @exception NotPresentException if this type is not present. */ boolean isDeprecated() throws NotPresentException; @@ -475,8 +421,8 @@ * Returns true if this object represents an inner class or interface, * false otherwise. * An inner class is one which can only be created in the context of - * an instance of its outer class. This does not include package member - * classes or other top-level classes. Such a class cannot be static. + * an instance of its outer class. This does not include package member + * classes or other top-level classes. Such a class cannot be static. * <p> * See the <em>Java Inner Classes Specification</em> for more details. * @@ -490,8 +436,8 @@ * This returns false if this object represents a class, * an array type, or a primitive type. * - * @return <code>true</code> if this object represents an interface; - * <code>false</code> otherwise. + * @return <code>true</code> if this object represents an interface; + * <code>false</code> otherwise. * @exception NotPresentException if this type is not present. * * @see #isArray @@ -608,7 +554,7 @@ * If this represents an array type, the string representation is * that of its component type followed by <code>"[]"</code>. * - * @return a string representation of this class object. + * @return a string representation of this class object. * @see IHandle#toString */ String toString();
diff --git a/model/org/eclipse/jdt/internal/core/builder/InvalidKeyException.java b/model/org/eclipse/jdt/internal/core/builder/InvalidKeyException.java index 4028f02..e633ea9 100644 --- a/model/org/eclipse/jdt/internal/core/builder/InvalidKeyException.java +++ b/model/org/eclipse/jdt/internal/core/builder/InvalidKeyException.java
@@ -1,23 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * Thrown when a DeltaKey is invalid. - * - * This exception is indicative of design flaws in the code. - * The offending code has constructed a key which could not possibly - * appear in a Delta. - * This is an unchecked exception (a subclass of RuntimeException) - * so that client code does not have to worry about catching this exception, - * which should never be thrown (or caught) in properly written code. - * - * @see DeltaKey - * @see IDelta#follow - */ public class InvalidKeyException extends RuntimeException { /** * Constructs an <code>InvalidKeyException</code> without a detail message. @@ -28,7 +10,7 @@ /** * Constructs an <code>InvalidKeyException</code> with a detail message. * - * @param s the detail message. + * @param s the detail message. */ public InvalidKeyException(String s) { super(s);
diff --git a/model/org/eclipse/jdt/internal/core/builder/NotPresentException.java b/model/org/eclipse/jdt/internal/core/builder/NotPresentException.java index 8547df4..270104a 100644 --- a/model/org/eclipse/jdt/internal/core/builder/NotPresentException.java +++ b/model/org/eclipse/jdt/internal/core/builder/NotPresentException.java
@@ -1,26 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * Thrown when a method is invoked on a handle whose object - * is not present. See <code>IHandle</code> for more details. - * - * This is an unchecked exception (a subclass of RuntimeException) - * because most of the time, code can ignore it if it is known to be - * navigating a state (see <code>IHandle</code> for more details). - * In some situations however, such as creating handles, the user - * would have to either - * <ol> - * <li>catch the exception, or</li> - * <li>test with <code>isPresent()</code> before performing the operation.</li> - * </ol> - * - * @see IHandle - */ public class NotPresentException extends RuntimeException { @@ -34,7 +13,7 @@ /** * Constructs a <code>NotPresentException</code> with a detail message. * - * @param s the detail message. + * @param s the detail message. */ public NotPresentException(String s) { super(s);
diff --git a/model/org/eclipse/jdt/internal/core/builder/SearchProgressEvent.java b/model/org/eclipse/jdt/internal/core/builder/SearchProgressEvent.java index 1cad2fb..7e36a1a 100644 --- a/model/org/eclipse/jdt/internal/core/builder/SearchProgressEvent.java +++ b/model/org/eclipse/jdt/internal/core/builder/SearchProgressEvent.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The listener event which is sent to all <code>ISearchListener</code>s - * when an <code>ISearch</code> has progress to report. - * - * @see ISearch - * @see ISearchListener - */ public class SearchProgressEvent extends java.util.EventObject { String name; /**
diff --git a/model/org/eclipse/jdt/internal/core/builder/SearchResultEvent.java b/model/org/eclipse/jdt/internal/core/builder/SearchResultEvent.java index 37c2e86..1e36d7c 100644 --- a/model/org/eclipse/jdt/internal/core/builder/SearchResultEvent.java +++ b/model/org/eclipse/jdt/internal/core/builder/SearchResultEvent.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The listener event which is sent to all <code>ISearchListener</code>s - * when an <code>ISearch</code> has a result to report. - * - * @see ISearch - * @see ISearchListener - */ public class SearchResultEvent extends java.util.EventObject { IHandle result; int[] fMatchingPositions;
diff --git a/model/org/eclipse/jdt/internal/core/builder/StateSpecificException.java b/model/org/eclipse/jdt/internal/core/builder/StateSpecificException.java index 972165a..c8d38bf 100644 --- a/model/org/eclipse/jdt/internal/core/builder/StateSpecificException.java +++ b/model/org/eclipse/jdt/internal/core/builder/StateSpecificException.java
@@ -1,25 +1,5 @@ package org.eclipse.jdt.internal.core.builder; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * Thrown when an operation is performed on a state-specific handle - * when it should be non-state-specific, or vice-versa. - * See <code>IHandle</code> for more details. - * - * This exception is indicative of design flaws in the code. - * The offending code is confused as to whether it is on the state-specific - * vs. non-state-specific side of the fence. - * This is an unchecked exception (a subclass of RuntimeException) - * so that client code does not have to worry about catching this exception, - * which should never be thrown (or caught) in properly written code. - * - * @see IHandle - * @see IState - */ public class StateSpecificException extends RuntimeException { @@ -33,7 +13,7 @@ /** * Constructs a <code>StateSpecificException</code> with a detail message. * - * @param s the detail message. + * @param s the detail message. */ public StateSpecificException(String s) { super(s);
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/AbstractMemberHandle.java b/model/org/eclipse/jdt/internal/core/builder/impl/AbstractMemberHandle.java index 3440f64..e234733 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/AbstractMemberHandle.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/AbstractMemberHandle.java
@@ -5,7 +5,6 @@ * All Rights Reserved. */ import org.eclipse.jdt.internal.core.builder.*; -import org.eclipse.jdt.internal.core.Util; public abstract class AbstractMemberHandle extends NonStateSpecificHandleImpl implements IMember{ /** @@ -24,7 +23,7 @@ String computeSignature(String name, IType[] parameterTypes) { if (parameterTypes.length == 0) { - return name + "()"/*nonNLS*/; + return name + "()"; } StringBuffer sb = new StringBuffer(name); @@ -33,7 +32,7 @@ try { ((TypeImpl)parameterTypes[i]).appendSignature(sb, true); } catch (ClassCastException e) { - throw new StateSpecificException("Incompatible parameter types"/*nonNLS*/); + throw new StateSpecificException("incompatible parameter types"); } } sb.append(')');
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/AbstractMethodCollaboratorIndictment.java b/model/org/eclipse/jdt/internal/core/builder/impl/AbstractMethodCollaboratorIndictment.java index b6c4016..1d39079 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/AbstractMethodCollaboratorIndictment.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/AbstractMethodCollaboratorIndictment.java
@@ -41,6 +41,6 @@ */ public String toString() { // don't use + with char[] - return new StringBuffer("AbstractMethodCollaboratorIndictment("/*nonNLS*/).append(fName).append(")"/*nonNLS*/).toString(); + return new StringBuffer("AbstractMethodCollaboratorIndictment(").append(fName).append(")").toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/AbstractNode.java b/model/org/eclipse/jdt/internal/core/builder/impl/AbstractNode.java index bb54ba7..20ecafa 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/AbstractNode.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/AbstractNode.java
@@ -5,11 +5,12 @@ * All Rights Reserved. */ import org.eclipse.jdt.internal.core.Assert; -import org.eclipse.jdt.internal.core.Util; import org.eclipse.jdt.internal.core.builder.IType; import org.eclipse.jdt.internal.core.util.Dumper; import org.eclipse.jdt.internal.core.util.IDumpable; +import java.util.*; + /** * A node in the image builder dependency graph. * @see IDependencyGraph @@ -119,7 +120,7 @@ /* add the dependent */ fDependents[min] = nodeThatDependsOnMe; } catch (ArrayIndexOutOfBoundsException e) { - System.out.println("ArrayIndexOutOfBoundsException in AbstractNode.copyAddDependent()"/*nonNLS*/); + System.out.println("ArrayIndexOutOfBoundsException in AbstractNode.copyAddDependent()"); } } /** @@ -148,28 +149,28 @@ * For debugging only. */ public void dump(Dumper dumper) { - dumper.dump("element"/*nonNLS*/, getElement()); + dumper.dump("element", getElement()); if (getKind() == JCU_NODE) - dumper.dump("types"/*nonNLS*/, getTypes()); + dumper.dump("types", getTypes()); Object[] dependencies = new Object[fDependencies.length]; for (int i = 0; i < fDependencies.length; ++i) { dependencies[i] = fDependencies[i].getElement(); } - dumper.dump("dependencies"/*nonNLS*/, dependencies); + dumper.dump("dependencies", dependencies); Object[] dependents = new Object[fNumDependents]; for (int i = 0; i < fDependents.length; ++i) { dependents[i] = fDependents[i].getElement(); } - dumper.dump("dependents"/*nonNLS*/, dependents); + dumper.dump("dependents", dependents); } /** * Make sure equality tests are never carried out on nodes */ public boolean equals(Object o) { - Assert.isTrue(false, "Internal Error - Equality not defined for dependency graph nodes"/*nonNLS*/); + Assert.isTrue(false, "Equality not defined for dependency graph nodes"); return false; } /** @@ -239,8 +240,10 @@ /** * Returns the types that belong to this node */ - public abstract IType[] getTypes(); - + public IType[] getTypes() { + Assert.isTrue(false, "My subclass should have implemented this"); + return null; + } /** * Invalidates the order number, for this node and all dependents. */ @@ -338,7 +341,7 @@ for (int i = 0; i < recursionLevel; ++i) sb.append(' '); sb.append(this); - sb.append(": "/*nonNLS*/); + sb.append(": "); sb.append(refCount); System.out.println(sb.toString()); }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ArrayTypeHandleImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/ArrayTypeHandleImpl.java index ac15d5b..48e86e7 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ArrayTypeHandleImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ArrayTypeHandleImpl.java
@@ -96,7 +96,7 @@ public String getName() { String name = fElementType.getName(); for (int i = 0; i < fNestingDepth; i++) - name += "[]"/*nonNLS*/; + name += "[]"; return name; } /** @@ -111,7 +111,7 @@ public String getSimpleName() { String simpleName = fElementType.getSimpleName(); for (int i = 0; i < fNestingDepth; i++) - simpleName += "[]"/*nonNLS*/; + simpleName += "[]"; return simpleName; } /**
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/BatchImageBuilder.java b/model/org/eclipse/jdt/internal/core/builder/impl/BatchImageBuilder.java index 453d8b1..fb3ba82 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/BatchImageBuilder.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/BatchImageBuilder.java
@@ -4,16 +4,11 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import java.util.Vector; - -import org.eclipse.jdt.internal.compiler.ConfigurableOption; -import org.eclipse.jdt.internal.compiler.ICompilerRequestor; import org.eclipse.jdt.internal.core.Assert; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.builder.IDelta; -import org.eclipse.jdt.internal.core.builder.IImageBuilder; -import org.eclipse.jdt.internal.core.builder.IImageContext; -import org.eclipse.jdt.internal.core.builder.IPackage; +import org.eclipse.jdt.internal.compiler.*; +import org.eclipse.jdt.internal.core.builder.*; + +import java.util.*; /** * The batch image builder - builds a state from scratch. @@ -54,15 +49,15 @@ fNotifier.begin(); try { fNewState.readClassPath(); - fNotifier.subTask(Util.bind("build.scrubbingOutput"/*nonNLS*/)); + fNotifier.subTask("Scrubbing output folder"); fNewState.getBinaryOutput().scrubOutput(); fNotifier.updateProgressDelta(0.05f); - fNotifier.subTask(Util.bind("build.analyzingPackages"/*nonNLS*/)); + fNotifier.subTask("Analyzing packages"); fNewState.buildInitialPackageMap(); fNotifier.updateProgressDelta(0.05f); /* Force build all in build context */ - fNotifier.subTask(Util.bind("build.analyzingSources"/*nonNLS*/)); + fNotifier.subTask("Analyzing sources"); IPackage[] pkgs = fNewState.getPackageMap().getAllPackagesAsArray(); for (int i = 0; i < pkgs.length; ++i) { fNotifier.checkCancel(); @@ -105,13 +100,13 @@ public void lazyBuild(PackageElement unit) { // String msg = "Attempt to lazy build " + unit.getPackage().getName() + "." + unit.getFileName(); // System.err.println(msg + ". " + "Lazy building has been disabled."); - Assert.isTrue(false, "Internal Error - Lazy building has been disabled"/*nonNLS*/); + Assert.isTrue(false, "Lazy building has been disabled."); } /** * Returns a string describe the builder * @see IImageBuilder */ public String toString() { - return "batch image builder for:\n\tnew state: "/*nonNLS*/ + getNewState(); + return "batch image builder for:\n\tnew state: " + getNewState(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/BuildNotifier.java b/model/org/eclipse/jdt/internal/core/builder/impl/BuildNotifier.java index fb4f4c9..43b6779 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/BuildNotifier.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/BuildNotifier.java
@@ -7,7 +7,6 @@ import org.eclipse.core.runtime.*; import org.eclipse.jdt.internal.core.builder.*; -import org.eclipse.jdt.internal.core.Util; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; import java.text.NumberFormat; @@ -46,10 +45,10 @@ } public void begin() { if (fBuildMonitor != null) { - fBuildMonitor.beginBuild(fIsBatch ? Util.bind("build.beginBatch"/*nonNLS*/) : Util.bind("build.beginIncremental"/*nonNLS*/)); + fBuildMonitor.beginBuild(fIsBatch ? "Begin batch build" : "Begin incremental build"); } if (fProgress != null) { - fProgress.beginTask(""/*nonNLS*/, fTotalWork); + fProgress.beginTask("", fTotalWork); } this.previousSubtask = null; } @@ -90,9 +89,9 @@ int start = message.indexOf('/', 1); int end = message.lastIndexOf('/'); if (end <= start){ - message = Util.bind("build.compiling"/*nonNLS*/, message.substring(start+1)); + message = "Compiling " + message.substring(start+1); } else { - message = Util.bind("build.compilingContent"/*nonNLS*/, message.substring(start+1, end)); + message = "Compiling content of " + message.substring(start+1, end); } subTask(message); updateProgressDelta(fProgressPerCompilationUnit/2); @@ -100,12 +99,12 @@ } public void done() { updateProgress(1.0f); - subTask(Util.bind("build.done"/*nonNLS*/)); + subTask("Build done"); if (fProgress != null) { fProgress.done(); } if (fBuildMonitor != null) { - fBuildMonitor.endBuild(fIsBatch ? Util.bind("build.endBatch"/*nonNLS*/) : Util.bind("build.endIncremental"/*nonNLS*/)); + fBuildMonitor.endBuild(fIsBatch ? "->End batch build" : "->End incremental build"); } this.previousSubtask = null; } @@ -154,16 +153,15 @@ int numNew = fNewErrorCount + fNewWarningCount; int numFixed = fFixedErrorCount + fFixedWarningCount; if (numNew == 0 && numFixed == 0) { - return ""/*nonNLS*/; + return ""; } if (numFixed == 0) { - return '(' + numNew == 1 ? Util.bind("build.oneProblemFound"/*nonNLS*/, String.valueOf(numNew)) : Util.bind("build.problemsFound"/*nonNLS*/, String.valueOf(numNew)) +')'; + return "(" + numNew + " " + (numNew == 1 ? "problem" : "problems") + " found)"; } else if (numNew == 0) { - return '(' + numFixed == 1 ? Util.bind("build.oneProblemFixed"/*nonNLS*/, String.valueOf(numFixed)) : Util.bind("build.problemsFixed"/*nonNLS*/, String.valueOf(numFixed)) + ')'; + return "(" + numFixed + " " + (numFixed == 1 ? "problem" : "problems") + " fixed)"; } else { - return '(' + (numFixed == 1 ? Util.bind("build.oneProblemFixed"/*nonNLS*/, String.valueOf(numFixed)) : Util.bind("build.problemsFixed"/*nonNLS*/, String.valueOf(numFixed))) - + (numNew == 1 ? Util.bind("build.oneProblemFound"/*nonNLS*/, String.valueOf(numNew)) : Util.bind("build.problemsFound"/*nonNLS*/, String.valueOf(numNew))) + ')'; + return "(" + numFixed + " " + (numFixed == 1 ? "problem" : "problems") + " fixed, " + numNew + " " + (numNew == 1 ? "problem" : "problems") + " found)"; } } /** @@ -183,7 +181,7 @@ } public void subTask(String message) { String pm = problemsMessage(); - String msg = pm.length() == 0 ? message : pm + " "/*nonNLS*/ + message; + String msg = pm.length() == 0 ? message : pm + " " + message; if (msg.equals(this.previousSubtask)) return; // avoid refreshing with same one if (DEBUG) System.out.println(msg);
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ClassOrInterfaceHandleImplSWH.java b/model/org/eclipse/jdt/internal/core/builder/impl/ClassOrInterfaceHandleImplSWH.java index 6f5d52f..180016d 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ClassOrInterfaceHandleImplSWH.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ClassOrInterfaceHandleImplSWH.java
@@ -206,7 +206,7 @@ public String getDeclaredName() throws NotPresentException { if (isAnonymous()) { - return ""/*nonNLS*/; + return ""; } String name = fHandle.getSimpleName();
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/CompilerCompilationUnit.java b/model/org/eclipse/jdt/internal/core/builder/impl/CompilerCompilationUnit.java index 37a5509..daa0395 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/CompilerCompilationUnit.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/CompilerCompilationUnit.java
@@ -64,6 +64,6 @@ } public String toString() { // don't use append(char[]) due to JDK1.2 problems - return new StringBuffer("CompilationUnit("/*nonNLS*/).append(getFileName()).append(")"/*nonNLS*/).toString(); + return new StringBuffer("CompilationUnit(").append(getFileName()).append(")").toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ConsoleProgressMonitor.java b/model/org/eclipse/jdt/internal/core/builder/impl/ConsoleProgressMonitor.java new file mode 100644 index 0000000..6075165 --- /dev/null +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ConsoleProgressMonitor.java
@@ -0,0 +1,78 @@ +package org.eclipse.jdt.internal.core.builder.impl; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * This progress monitor is used as the default progress monitor in cases + * where none has been set. It is used mainly for test cases. The monitor + * simply echoes updates to the console (System.out). + */ +class ConsoleProgressMonitor implements IProgressMonitor { + protected int fTotalWork; + protected int fWorkDone; + /** + * beginTask method comment. + */ + public void beginTask(String name, int totalWork) { + System.out.println(name + ", total work: " + totalWork); + fTotalWork = totalWork; + fWorkDone = 0; + } + /** + * done method comment. + */ + public void done() { + System.out.println("Task Done"); + fTotalWork = 0; + fWorkDone = 0; + } +public void internalWorked(double work) { + fWorkDone += work; + double percent = (double)fWorkDone / (double)fTotalWork; + percent *= 100; + System.out.println("\t" + percent + "% work done"); + } + /** + * isCanceled method comment. + */ + public boolean isCanceled() { + return false; + } + /** + * setCanceled method comment. + */ + public void setCanceled(boolean b) { + } + /** + * setTaskName method comment. + */ + public void setTaskName(String name) { + System.out.println("\t" + name); + } + /** + * subTask method comment. + */ + public void subTask(String name) { + System.out.println("\t" + name); + } + /** + * Returns a String that represents the value of this object. + * @return a string representation of the receiver + */ + public String toString() { + return "Default ImageBuilder Progress Monitor"; + } + /** + * worked method comment. + */ + public void worked(int work) { + fWorkDone += work; + double percent = (double)fWorkDone / (double)fTotalWork; + percent *= 100; + System.out.println("\t" + percent + "% work done"); + } +}
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ConstructorImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/ConstructorImpl.java index 260240a..22f27bd 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ConstructorImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ConstructorImpl.java
@@ -9,7 +9,7 @@ public class ConstructorImpl extends AbstractMemberHandle implements IConstructor { ConstructorImpl (ClassOrInterfaceHandleImpl owner, IType[] paramTypes) { fOwner = owner; - fSignature = computeSignature(""/*nonNLS*/, paramTypes); + fSignature = computeSignature("", paramTypes); } public ConstructorImpl(ClassOrInterfaceHandleImpl owner, String signature) { fOwner = owner;
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ConvertedCompilationResult.java b/model/org/eclipse/jdt/internal/core/builder/impl/ConvertedCompilationResult.java index d023e60..ae8714c 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ConvertedCompilationResult.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ConvertedCompilationResult.java
@@ -38,6 +38,6 @@ return fTypes; } public String toString() { - return (fProblems.length == 0 ? ""/*nonNLS*/ : "*"/*nonNLS*/) + "ConvertedCompilationResult("/*nonNLS*/ + fPackageElement + ")"/*nonNLS*/; + return (fProblems.length == 0 ? "" : "*") + "ConvertedCompilationResult(" + fPackageElement + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/DeltaImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/DeltaImpl.java index 5407ba1..dbf9941 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/DeltaImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/DeltaImpl.java
@@ -28,17 +28,17 @@ protected IImageContext fContext; /* names for checklist items */ - public static final String fgImage = "Image"/*nonNLS*/; + public static final String fgImage = "Image"; - public static final String fgPackageCategory = "Packages"/*nonNLS*/; - public static final String fgTypeCategory = "Types"/*nonNLS*/; - public static final String fgBinaryCategory = "Binaries"/*nonNLS*/; - public static final String fgMethodCategory = "Methods"/*nonNLS*/; + public static final String fgPackageCategory = "Packages"; + public static final String fgTypeCategory = "Types"; + public static final String fgBinaryCategory = "Binaries"; + public static final String fgMethodCategory = "Methods"; - public static final String fgPackage = "Package"/*nonNLS*/; - public static final String fgType = "Type"/*nonNLS*/; - public static final String fgBinary = "Binary"/*nonNLS*/; - public static final String fgMethod = "Method"/*nonNLS*/; + public static final String fgPackage = "Package"; + public static final String fgType = "Type"; + public static final String fgBinary = "Binary"; + public static final String fgMethod = "Method"; /* convenience structure for delta calculation process */ class DeltaInfo { @@ -99,7 +99,7 @@ fNewState = (StateImpl)newState; fOldState = (StateImpl)oldState; } catch (ClassCastException cce) { - Assert.isTrue(false, "Internal Error - Invalid states"/*nonNLS*/); + Assert.isTrue(false, "Invalid states"); } fStatus = CHANGED; fName = fgImage; @@ -131,17 +131,16 @@ * Returns the child of this delta with the given object */ protected IDelta at(Object o) { - if (fChildren != null){ - for (int i = 0; i < fChildren.length; i++) { - if (o instanceof String) { - if (o.equals(fChildren[i].getName())) { - return fChildren[i]; - } + Assert.isNotNull(fChildren, "navigating off a leaf delta!"); + for (int i = 0; i < fChildren.length; i++) { + if (o instanceof String) { + if (o.equals(fChildren[i].getName())) { + return fChildren[i]; } - else { - if (o.equals(fChildren[i].getObject())) { - return fChildren[i]; - } + } + else { + if (o.equals(fChildren[i].getObject())) { + return fChildren[i]; } } } @@ -200,7 +199,7 @@ */ public int compareTo(IDelta anotherDelta) { /* is this used? */ - Assert.isTrue(false, "TBD"/*nonNLS*/); + Assert.isTrue(false, "TBD"); return 0; } /** @@ -396,6 +395,8 @@ for (Enumeration e = toRemove.elements(); e.hasMoreElements();) { pkgs.removeElement(e.nextElement()); } + + Assert.isTrue(vInfo.size() == pkgs.size(), "sanity check"); /* convert info vector to array */ PackageInfo[] infos = new PackageInfo[vInfo.size()]; @@ -606,7 +607,7 @@ } protected static void dump(IDelta delta, int depth) { for (int i = 0; i < depth; ++i) - System.out.print(" "/*nonNLS*/); + System.out.print(" "); System.out.println(delta); IDelta[] children = delta.getAffectedSubdeltas(); for (int i = 0; i < children.length; ++i) { @@ -893,23 +894,23 @@ * @return java.lang.String */ public String toString() { - StringBuffer sb = new StringBuffer("DeltaImpl("/*nonNLS*/); + StringBuffer sb = new StringBuffer("DeltaImpl("); switch (fStatus) { - case ADDED: sb.append("+"/*nonNLS*/); + case ADDED: sb.append("+"); break; - case REMOVED: sb.append("-"/*nonNLS*/); + case REMOVED: sb.append("-"); break; - case CHANGED: sb.append("*"/*nonNLS*/); + case CHANGED: sb.append("*"); break; - case SAME: sb.append("="/*nonNLS*/); + case SAME: sb.append("="); break; - case UNKNOWN: sb.append("?"/*nonNLS*/); + case UNKNOWN: sb.append("?"); break; - default: sb.append("(ERROR)"/*nonNLS*/); + default: sb.append("(ERROR)"); } if (fKey.isRoot()) { sb.append(fOldState); - sb.append("-->"/*nonNLS*/); + sb.append("-->"); sb.append(fNewState); } else {
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/DependencyGraph.java b/model/org/eclipse/jdt/internal/core/builder/impl/DependencyGraph.java index feeaac1..c23580e 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/DependencyGraph.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/DependencyGraph.java
@@ -9,7 +9,6 @@ import org.eclipse.jdt.internal.core.Assert; import org.eclipse.jdt.internal.core.builder.*; import org.eclipse.jdt.internal.core.util.*; -import org.eclipse.jdt.internal.core.Util; import java.util.*; @@ -106,7 +105,7 @@ } catch (CloneNotSupportedException e) { // Should not happen since we implement Cloneable - Assert.isTrue(false, "Unexpected clone exception in DependencyGraph.clone()"/*nonNLS*/); + Assert.isTrue(false, "Unexpected clone exception in DependencyGraph.clone()"); return null; } } @@ -186,7 +185,7 @@ value = fZips.remove(((ZipNode)toRemove).getZipFile()); break; default: - Assert.isTrue(false, "Attempt to delete unknown node type from dependency graph"/*nonNLS*/); + Assert.isTrue(false, "Attempt to delete unknown node type from dependency graph"); } return (INode)value; } @@ -194,7 +193,7 @@ * For debugging only. Dump the graph in readable form. */ public void dump(Dumper dumper) { - dumper.dumpMessage("Namespaces"/*nonNLS*/, ""/*nonNLS*/); + dumper.dumpMessage("Namespaces", ""); dumper.indent(); for (Enumeration e = fNamespaces.elements(); e.hasMoreElements();) { AbstractNode node = (AbstractNode) e.nextElement(); @@ -202,7 +201,7 @@ } dumper.outdent(); - dumper.dumpMessage("JCUs"/*nonNLS*/, ""/*nonNLS*/); + dumper.dumpMessage("JCUs", ""); dumper.indent(); for (Enumeration e = fCompilationUnits.elements(); e.hasMoreElements();) { AbstractNode node = (AbstractNode) e.nextElement(); @@ -210,7 +209,7 @@ } dumper.outdent(); - dumper.dumpMessage("ZIPs"/*nonNLS*/, ""/*nonNLS*/); + dumper.dumpMessage("ZIPs", ""); dumper.indent(); for (Enumeration e = fZips.elements(); e.hasMoreElements();) { AbstractNode node = (AbstractNode) e.nextElement(); @@ -312,7 +311,7 @@ return getNodeFor((IPath)o, create); } else { - Assert.isTrue(false, "Unknown kind of node"/*nonNLS*/); + Assert.isTrue(false, "Unknown kind of node."); return null; } } @@ -477,7 +476,7 @@ * For debugging only -- asserts graph integrity */ public void integrityCheck(Dictionary table) { - String msg = "Internal Error: the dependency graph is corrupt, do a full build to workaround error"/*nonNLS*/; + String msg = "Internal Error: the dependency graph is corrupt, do a full build to workaround error."; for (Enumeration e = table.elements(); e.hasMoreElements();) { AbstractNode node = (AbstractNode) e.nextElement(); @@ -564,6 +563,6 @@ return fNamespaces.size() + fTypes.size() + fCompilationUnits.size(); } public String toString() { - return "a DependencyGraph"/*nonNLS*/; + return "a DependencyGraph"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/FieldCollaboratorIndictment.java b/model/org/eclipse/jdt/internal/core/builder/impl/FieldCollaboratorIndictment.java index 9f30f02..a83464f 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/FieldCollaboratorIndictment.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/FieldCollaboratorIndictment.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.builder.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; class FieldCollaboratorIndictment extends Indictment { /** @@ -24,6 +19,6 @@ */ public String toString() { // don't use + with char[] - return new StringBuffer("FieldIndictment("/*nonNLS*/).append(fName).append(")"/*nonNLS*/).toString(); + return new StringBuffer("FieldIndictment(").append(fName).append(")").toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/FieldImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/FieldImpl.java index c2762ae..7349618 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/FieldImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/FieldImpl.java
@@ -44,6 +44,6 @@ * toString method comment. */ public String toString() { - return getDeclaringClass().getName() + "."/*nonNLS*/ + getName(); + return getDeclaringClass().getName() + "." + getName(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ImageBuilderInternalException.java b/model/org/eclipse/jdt/internal/core/builder/impl/ImageBuilderInternalException.java index 3c67b9e..2dcd49a 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ImageBuilderInternalException.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ImageBuilderInternalException.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.core.builder.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * Exception thrown when there is an internal error in the image builder. - * May wrapper another exception. - */ public class ImageBuilderInternalException extends RuntimeException { protected Throwable fThrowable; /** @@ -40,7 +31,7 @@ public void printStackTrace() { if (fThrowable != null) { System.err.println(this); - System.err.println("Stack trace of embedded throwable:"/*nonNLS*/); + System.err.println("Stack trace of embedded throwable:"); fThrowable.printStackTrace(); } else { super.printStackTrace();
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ImageContextImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/ImageContextImpl.java index 210df5c..9935709 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ImageContextImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ImageContextImpl.java
@@ -88,9 +88,9 @@ * purposes only. */ public String toString() { - StringBuffer buf = new StringBuffer("ImageContext with packages: \n"/*nonNLS*/); + StringBuffer buf = new StringBuffer("ImageContext with packages: \n"); for (int i = 0; i < fPackages.length; i++) - buf.append(" "/*nonNLS*/ + fPackages[i].getName() + "\n"/*nonNLS*/); + buf.append(" " + fPackages[i].getName() + "\n"); return buf.toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ImageImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/ImageImpl.java index 1bf30c2..8838243 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ImageImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ImageImpl.java
@@ -199,7 +199,7 @@ * Returns a string representation of the image handle. */ public String toString() { - return "image"/*nonNLS*/; + return "image"; } /** * Returns the Type representing the primitive type void
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ImageImplSWH.java b/model/org/eclipse/jdt/internal/core/builder/impl/ImageImplSWH.java index 1d35ceb..8b2329b 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ImageImplSWH.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ImageImplSWH.java
@@ -114,7 +114,7 @@ Vector vResult = new Vector(); // try { String extension = path.getFileExtension().toLowerCase(); - if (extension.equals("java"/*nonNLS*/) || extension.equals("class"/*nonNLS*/)) { + if (extension.equals("java") || extension.equals("class")) { IPath pkgPath = path.removeLastSegments(1); IPackage pkg = fState.getPathMap().packageHandleFromPath(pkgPath); TypeStructureEntry[] tsEntries = fState.getAllTypesForPackage(pkg);
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/IncrementalImageBuilder.java b/model/org/eclipse/jdt/internal/core/builder/impl/IncrementalImageBuilder.java index 224ee43..e01d6c8 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/IncrementalImageBuilder.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/IncrementalImageBuilder.java
@@ -23,7 +23,7 @@ import org.eclipse.jdt.internal.core.builder.IType; import org.eclipse.jdt.internal.core.builder.NotPresentException; import org.eclipse.jdt.internal.core.lookup.ReferenceInfo; -import org.eclipse.jdt.internal.core.Util; + import org.eclipse.jdt.internal.compiler.util.*; import org.eclipse.jdt.internal.core.*; @@ -155,7 +155,7 @@ IPath path = elementDelta.getFullPath(); String extension = path.getFileExtension(); if (extension != null) { - if (extension.equalsIgnoreCase("java"/*nonNLS*/) || extension.equalsIgnoreCase("class"/*nonNLS*/)) { + if (extension.equalsIgnoreCase("java") || extension.equalsIgnoreCase("class")) { SourceEntry entry = new SourceEntry(path, null, null); PackageElement element = new PackageElement(pkg, entry); pkgTable.put(entry.getFileName(), element); @@ -198,7 +198,7 @@ public void applySourceDelta(Hashtable deltas) { fNotifier = new BuildNotifier(fDC, false); fNotifier.begin(); - fNotifier.subTask(Util.bind("build.preparingBuild"/*nonNLS*/)); + fNotifier.subTask("Preparing for build"); fSourceDeltas = deltas; fNewState = fOldState.copy(fNewProject, fImageContext); @@ -208,7 +208,7 @@ try { /* find out what has changed at the package level */ - fNotifier.subTask(Util.bind("build.analyzingPackages"/*nonNLS*/)); + fNotifier.subTask("Analyzing packages"); computeAllPackages(); checkCancel(); @@ -236,7 +236,7 @@ } /* find out what has changed at the package element level */ - fNotifier.subTask(Util.bind("build.analyzingSources"/*nonNLS*/)); + fNotifier.subTask("Analyzing sources"); computeAllClasses(); checkCancel(); @@ -582,8 +582,8 @@ for (int i = 0; i < children.length; ++i) { String extension = children[i].getFullPath().getFileExtension(); if (extension == null - || extension.equalsIgnoreCase("zip"/*nonNLS*/) - || extension.equalsIgnoreCase("jar"/*nonNLS*/)) { + || extension.equalsIgnoreCase("zip") + || extension.equalsIgnoreCase("jar")) { // TBD: Currently rely on empty extension indicating folder computeAllPackages(children[i], oldRoots, newRoots); } @@ -628,7 +628,7 @@ // Process added packages for (Enumeration addedPkgs = fAddedPackageHandles.elements(); addedPkgs.hasMoreElements();) { IPackage pkg = (IPackage) addedPkgs.nextElement(); - fNotifier.subTask(Util.bind("build.analyzing"/*nonNLS*/, PackageImpl.readableName(pkg))); + fNotifier.subTask("Analyzing " + PackageImpl.readableName(pkg)); // Mark all dependents of missing namespace as needing compile. markDependentsAsNeedingCompile(pkg); @@ -643,7 +643,7 @@ // Process removed packages for (Enumeration removedPkgs = fRemovedPackageHandles.elements(); removedPkgs.hasMoreElements();) { IPackage pkg = (IPackage) removedPkgs.nextElement(); - fNotifier.subTask(Util.bind("build.analyzing"/*nonNLS*/, PackageImpl.readableName(pkg))); + fNotifier.subTask("Analyzing " + PackageImpl.readableName(pkg)); // Mark all dependents of namespace as needing compile. markDependentsAsNeedingCompile(pkg); @@ -658,7 +658,7 @@ // Process changed packages for (Enumeration changedPkgs = fChangedPackageHandles.elements(); changedPkgs.hasMoreElements();) { IPackage pkg = (IPackage) changedPkgs.nextElement(); - fNotifier.subTask(Util.bind("build.analyzing"/*nonNLS*/, PackageImpl.readableName(pkg))); + fNotifier.subTask("Analyzing " + PackageImpl.readableName(pkg)); computeNamespaceChanges(pkg); fNotifier.updateProgressDelta(progressDelta); fNotifier.checkCancel(); @@ -671,7 +671,7 @@ String typeName = type.getElementName(); if (parentTypeName != null) { int len = parentTypeName.length() + typeName.length() + 1; - typeName = new StringBuffer(len).append(parentTypeName).append("$"/*nonNLS*/).append(typeName).toString(); + typeName = new StringBuffer(len).append(parentTypeName).append("$").append(typeName).toString(); } /* Remove it so that only non-matching ones remain in the table. */ TypeStructureEntry tsEntry = (TypeStructureEntry) oldTSEntries.remove(typeName); @@ -914,7 +914,7 @@ StringBuffer sb = new StringBuffer(); IPath path = delta.getFullPath(); for (int i = path.segmentCount(); --i > 0;) { - sb.append(" "/*nonNLS*/); + sb.append(" "); } switch (delta.getKind()) { case IResourceDelta.ADDED: @@ -1048,7 +1048,7 @@ /* skip non-java resources */ String extension = path.getFileExtension(); - if (extension != null && (extension.equalsIgnoreCase("java"/*nonNLS*/) || extension.equalsIgnoreCase("class"/*nonNLS*/))) { + if (extension != null && (extension.equalsIgnoreCase("java") || extension.equalsIgnoreCase("class"))) { set.put(path, path); } } @@ -1072,7 +1072,7 @@ IResourceDelta changed = (IResourceDelta) e.nextElement(); String extension = changed.getFullPath().getFileExtension(); if (extension != null) { - if (extension.equalsIgnoreCase("zip"/*nonNLS*/) || extension.equalsIgnoreCase("jar"/*nonNLS*/)) { + if (extension.equalsIgnoreCase("zip") || extension.equalsIgnoreCase("jar")) { return true; } } @@ -1127,7 +1127,7 @@ /* skip java resources */ String extension = path.getFileExtension(); if (extension != null) { - if ((extension.equalsIgnoreCase("java"/*nonNLS*/) || extension.equalsIgnoreCase("class"/*nonNLS*/))) { + if ((extension.equalsIgnoreCase("java") || extension.equalsIgnoreCase("class"))) { /* if there is an added or removed jcu or binary, the source entries have changed */ int status = fileDeltas[j].getKind(); if (status == IResourceDelta.ADDED || status == IResourceDelta.REMOVED) { @@ -1423,7 +1423,7 @@ * @see IImageBuilder */ public String toString() { - return "incremental image builder for:\n"/*nonNLS*/ + "\tnew state: "/*nonNLS*/ + getNewState() + "\n"/*nonNLS*/ + "\told state: "/*nonNLS*/ + getOldState(); + return "incremental image builder for:\n" + "\tnew state: " + getNewState() + "\n" + "\told state: " + getOldState(); } /** * If this type is a subtype is the originator of an abstract method @@ -1634,7 +1634,7 @@ for (int i = 0; i < types.length; ++i) { IType superclass = getBuilderType(types[i]).getSuperclass(); if (superclass != null) { - String key = '<' + superclass.getDeclaredName() + ">/0"/*nonNLS*/; + String key = '<' + superclass.getDeclaredName() + ">/0"; if (indictments.tryMethodEvidence(key.toCharArray())) { return true; }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/IndictmentSet.java b/model/org/eclipse/jdt/internal/core/builder/impl/IndictmentSet.java index b9040e5..09893da 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/IndictmentSet.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/IndictmentSet.java
@@ -56,7 +56,7 @@ fMethodOwners = new Hashtable(11); fMethodOwners.put(owner, owner); fMethodOwnersArray = null; - if (i.getName().startsWith("<"/*nonNLS*/)) { + if (i.getName().startsWith("<")) { fHasConstructorIndictments = true; } break; @@ -71,7 +71,7 @@ fAbstractMethodTable.put(i.getKey(), i); break; default: - Assert.isTrue(false, "Internal Error - Unexpected kind of indictment"/*nonNLS*/); + Assert.isTrue(false, "Unexpected kind of indictment"); break; } } @@ -161,13 +161,13 @@ */ public String toString() { return - "IndictmentSet("/*nonNLS*/ - + "\n hierarchyChange: "/*nonNLS*/ + fHierarchyChange - + "\n types:\n"/*nonNLS*/ + fTypesTable - + "\n interfaces:\n"/*nonNLS*/ + fAbstractMethodTable - + "\n methods:\n"/*nonNLS*/ + fMethodsTable - + "\n fields:\n"/*nonNLS*/ + fFieldsTable - + "\n)"/*nonNLS*/; + "IndictmentSet(" + + "\n hierarchyChange: " + fHierarchyChange + + "\n types:\n" + fTypesTable + + "\n interfaces:\n" + fAbstractMethodTable + + "\n methods:\n" + fMethodsTable + + "\n fields:\n" + fFieldsTable + + "\n)"; } /**
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/JCUNode.java b/model/org/eclipse/jdt/internal/core/builder/impl/JCUNode.java index 192d626..56b0d58 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/JCUNode.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/JCUNode.java
@@ -86,6 +86,6 @@ * purposes only. */ public String toString() { - return "JCUNode("/*nonNLS*/ + fUnit.getFileName() + ")"/*nonNLS*/; + return "JCUNode(" + fUnit.getFileName() + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/JavaBuilder.java b/model/org/eclipse/jdt/internal/core/builder/impl/JavaBuilder.java index 43dd321..1edcf35 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/JavaBuilder.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/JavaBuilder.java
@@ -60,7 +60,7 @@ if (e.getThrowable() instanceof CoreException) { throw (CoreException) e.getThrowable(); } else { - throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("build.builderName"/*nonNLS*/), e)); + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, "Java Builder", e)); } } catch (OperationCanceledException e) { // Do nothing for now, and avoid propagating the exception. @@ -74,7 +74,7 @@ // forcing a full build next time. setLastBuiltState(null); } - if (monitor != null) monitor.subTask(Util.bind("build.completed"/*nonNLS*/)); + if (monitor != null) monitor.subTask("Java build completed"); } return getRequiredProjects(getLastBuiltState(monitor)); } @@ -93,28 +93,28 @@ Hashtable deltas = new Hashtable(11); IProject project = getProject(); - if (monitor != null) monitor.subTask(Util.bind("build.readingDelta"/*nonNLS*/, project.getName())); + if (monitor != null) monitor.subTask("Reading resource change information for :"+ project.getName()); IResourceDelta delta = getDelta(project); if (delta == null){ //System.out.println("Missing delta for: "+ project.getName()); - if (monitor != null) monitor.subTask(""/*nonNLS*/); + if (monitor != null) monitor.subTask(""); return null; } else { deltas.put(project, delta); } IProject[] prereqs = getRequiredProjects(oldState); for (int i = 0; i < prereqs.length; ++i) { - if (monitor != null) monitor.subTask(Util.bind("build.readingDelta"/*nonNLS*/, prereqs[i].getName())); + if (monitor != null) monitor.subTask("Reading resource change information for :"+ prereqs[i].getName()); delta = getDelta(prereqs[i]); if (delta == null){ //System.out.println("Missing delta for: "+ prereqs[i].getName()); - if (monitor != null) monitor.subTask(""/*nonNLS*/); + if (monitor != null) monitor.subTask(""); return null; } else { deltas.put(prereqs[i], delta); } } - if (monitor != null) monitor.subTask(""/*nonNLS*/); + if (monitor != null) monitor.subTask(""); return deltas; } /** @@ -127,7 +127,7 @@ return !Util.equalArraysOrNull(oldRoots, newRoots); } catch (JavaModelException e) { throw new CoreException( - new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("element.projectDoesNotExist"/*nonNLS*/, getProject().getFullPath().toString()), e)); + new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Project "+ getProject().getFullPath() +" not present", e)); } } /** @@ -237,8 +237,8 @@ int flags = change.getFlags(); boolean contentChanged = isChanged && (flags & IResourceDelta.CONTENT) != 0; String extension = change.getFullPath().getFileExtension(); - boolean isJavaOrClassFile = extension != null && (extension.equalsIgnoreCase("java"/*nonNLS*/) || extension.equalsIgnoreCase("class"/*nonNLS*/)); - boolean isArchive = extension != null && (extension.equalsIgnoreCase("zip"/*nonNLS*/) || extension.equalsIgnoreCase("jar"/*nonNLS*/)); + boolean isJavaOrClassFile = extension != null && (extension.equalsIgnoreCase("java") || extension.equalsIgnoreCase("class")); + boolean isArchive = extension != null && (extension.equalsIgnoreCase("zip") || extension.equalsIgnoreCase("jar")); // care about added, removed and modified (content actually modified) .java and .class files if (isJavaOrClassFile && (isAdded || isRemoved || contentChanged)) @@ -288,7 +288,7 @@ IPath newOutputLocation = getJavaProject().getOutputLocation(); return !oldOutputLocation.equals(newOutputLocation); } catch (JavaModelException e) { - throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("element.projectDoesNotExist"/*nonNLS*/, getProject().getFullPath().toString()), e)); + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Project "+ getProject().getFullPath() +" not present", e)); } } protected void setLastBuiltState(IState state) { @@ -300,9 +300,9 @@ public String toString() { IState lastBuiltState = getLastBuiltState(null); if (lastBuiltState == null) { - return "JavaBuilder(no built state)"/*nonNLS*/; + return "JavaBuilder(no built state)"; } else { - return "JavaBuilder("/*nonNLS*/ + lastBuiltState + ")"/*nonNLS*/; + return "JavaBuilder(" + lastBuiltState + ")"; } } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/JavaDevelopmentContextImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/JavaDevelopmentContextImpl.java index 3b894ea..2f4dcc4 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/JavaDevelopmentContextImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/JavaDevelopmentContextImpl.java
@@ -4,35 +4,18 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Locale; -import java.util.Vector; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.core.resources.IProject; +import org.eclipse.jdt.internal.core.builder.*; +import java.io.*; +import java.util.*; import org.eclipse.jdt.internal.compiler.Compiler; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.internal.core.util.IProgressListener; import org.eclipse.jdt.internal.compiler.ConfigurableOption; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.builder.IBinaryBroker; -import org.eclipse.jdt.internal.core.builder.IBuildListener; -import org.eclipse.jdt.internal.core.builder.IBuildMonitor; -import org.eclipse.jdt.internal.core.builder.IDevelopmentContext; -import org.eclipse.jdt.internal.core.builder.IImage; -import org.eclipse.jdt.internal.core.builder.IImageBuilder; -import org.eclipse.jdt.internal.core.builder.IImageContext; -import org.eclipse.jdt.internal.core.builder.IPackage; -import org.eclipse.jdt.internal.core.builder.IProblemReporter; -import org.eclipse.jdt.internal.core.builder.IState; -import org.eclipse.jdt.internal.core.builder.IType; -import org.eclipse.jdt.internal.core.builder.NotPresentException; -import org.eclipse.jdt.internal.core.util.IProgressListener; + +import org.eclipse.core.runtime.IPath; public class JavaDevelopmentContextImpl implements IDevelopmentContext { @@ -70,12 +53,12 @@ /** * The default package. */ - private final IPackage fDefaultPackage = fImage.getPackageHandle("java.lang"/*nonNLS*/, false); + private final IPackage fDefaultPackage = fImage.getPackageHandle("java.lang", false); /** * The root class handle */ - private final IType fRootClass = fDefaultPackage.getClassHandle("Object"/*nonNLS*/); + private final IType fRootClass = fDefaultPackage.getClassHandle("Object"); /** * Primitive types @@ -195,7 +178,7 @@ } public IState getCurrentState() throws NotPresentException { if (fCurrentState == null) { - throw new NotPresentException("Internal Error - No current state"/*nonNLS*/); + throw new NotPresentException("no current state"); } return fCurrentState; } @@ -303,7 +286,7 @@ char c = localSig.charAt(position); if (c == 'L' || c == 'Q') { /* its a class type */ - int endIndex = localSig.indexOf(";"/*nonNLS*/) + 1; + int endIndex = localSig.indexOf(";") + 1; parmType = classTypeFromName(localSig.substring(position, endIndex)); localSig = localSig.substring(endIndex); } else { @@ -356,10 +339,12 @@ return new StateSnap().read(this, project, in); } catch (RuntimeException e) { + System.out.println("RuntimeException restoring state:"); e.printStackTrace(); throw e; } catch (Error e) { + System.out.println("Error restoring state:"); e.printStackTrace(); throw e; } @@ -372,14 +357,17 @@ new StateSnap().save((StateImpl) state, out); } catch (IOException e) { + System.out.println("IOException saving state: "); e.printStackTrace(); throw e; } catch (RuntimeException e) { + System.out.println("RuntimeException saving state: "); e.printStackTrace(); throw e; } catch (Error e) { + System.out.println("Error saving state:"); e.printStackTrace(); throw e; } @@ -429,6 +417,6 @@ fProgressMonitor = monitor; } public String toString() { - return "a JavaDevelopmentContextImpl("/*nonNLS*/ + fCurrentState + ")"/*nonNLS*/; + return "a JavaDevelopmentContextImpl(" + fCurrentState + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/MarkerProblemReporter.java b/model/org/eclipse/jdt/internal/core/builder/impl/MarkerProblemReporter.java index b98c6ab..1077ffe 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/MarkerProblemReporter.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/MarkerProblemReporter.java
@@ -128,7 +128,7 @@ if ((sev & ProblemDetailImpl.S_SYNTAX_ERROR) != 0) { setFlags(marker, ProblemDetailImpl.S_SYNTAX_ERROR); } - marker.setAttribute("ID"/*nonNLS*/, new Integer(problem.getID())); + marker.setAttribute("ID", new Integer(problem.getID())); int start = problem.getStartPos(); marker.setAttribute(IMarker.CHAR_START, new Integer(start));
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/MethodCollaboratorIndictment.java b/model/org/eclipse/jdt/internal/core/builder/impl/MethodCollaboratorIndictment.java index 4d8740e..3837455 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/MethodCollaboratorIndictment.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/MethodCollaboratorIndictment.java
@@ -57,7 +57,7 @@ * only (NON-NLS). */ public String toString() { - StringBuffer buf = new StringBuffer("MethodIndictment("/*nonNLS*/); + StringBuffer buf = new StringBuffer("MethodIndictment("); buf.append(fName); buf.append('/'); buf.append(fParmCount);
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/MethodImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/MethodImpl.java index 9f37f90..a42e18f 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/MethodImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/MethodImpl.java
@@ -61,14 +61,14 @@ * unqualified source signature format. */ protected String getSourceParameters() { - String sourceSig = "("/*nonNLS*/; + String sourceSig = "("; /* append parameter types to signature */ IType[] parms = getParameterTypes(); for (int i = 0; i < parms.length; i++) { sourceSig += parms[i].getSimpleName().replace('L', 'Q'); } - sourceSig += ")"/*nonNLS*/; + sourceSig += ")"; return sourceSig; } /**
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ModifiedBuilderType.java b/model/org/eclipse/jdt/internal/core/builder/impl/ModifiedBuilderType.java index 283589f..49e92da 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ModifiedBuilderType.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ModifiedBuilderType.java
@@ -249,7 +249,7 @@ * For debugging only */ public String toString() { - StringBuffer buf = new StringBuffer("ModifiedBuilderType("/*nonNLS*/); - return buf.append(fOldTSEntry.getType().getName()).append(')').toString(); + StringBuffer buf = new StringBuffer("ModifiedBuilderType("); + return buf.append(fOldTSEntry.getType().getName()).append(")").toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/NamespaceNode.java b/model/org/eclipse/jdt/internal/core/builder/impl/NamespaceNode.java index 8520582..b05e970 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/NamespaceNode.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/NamespaceNode.java
@@ -6,7 +6,6 @@ */ import org.eclipse.jdt.internal.core.Assert; import org.eclipse.jdt.internal.core.builder.IPackage; -import org.eclipse.jdt.internal.core.builder.IType; /** * @@ -19,13 +18,11 @@ public NamespaceNode (IPackage pkg) { fPackage = pkg; } - public IType[] getTypes(){ - return null; - } /** * Adds a node that this node depends on. Backwards link is added automatically */ public void addDependency(INode nodeThatIDependOn) { + Assert.isTrue(false, "namespaces cannot have dependencies"); } /** * Returns a copy of this node, without copying dependencies. Used @@ -62,6 +59,6 @@ * purposes only. */ public String toString() { - return "NamespaceNode("/*nonNLS*/ + fPackage.getName() + ")"/*nonNLS*/; + return "NamespaceNode(" + fPackage.getName() + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/NewBuilderType.java b/model/org/eclipse/jdt/internal/core/builder/impl/NewBuilderType.java index 1b40365..04dbed8 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/NewBuilderType.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/NewBuilderType.java
@@ -1,13 +1,5 @@ package org.eclipse.jdt.internal.core.builder.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A type that only exists in the new state (an addition) - */ public class NewBuilderType extends BuilderType { /** * The tsEntry in the new state @@ -48,6 +40,6 @@ * For debugging only */ public String toString() { - return "NewBuilderType("/*nonNLS*/ + fNewTSEntry.getType().getName() + ")"/*nonNLS*/; + return "NewBuilderType(" + fNewTSEntry.getType().getName() + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/NonStateSpecificHandleImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/NonStateSpecificHandleImpl.java index 2b5be96..9d73832 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/NonStateSpecificHandleImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/NonStateSpecificHandleImpl.java
@@ -9,7 +9,7 @@ public abstract class NonStateSpecificHandleImpl implements IHandle { public boolean equals(Object obj) { - Assert.isTrue(false, "TBD"/*nonNLS*/); + Assert.isTrue(false, "TBD"); return false; } public IDevelopmentContext getDevelopmentContext() { @@ -107,7 +107,7 @@ return result; } public String toString() { - Assert.isTrue(false, "TBD"/*nonNLS*/); + Assert.isTrue(false, "TBD"); return null; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/OldBuilderType.java b/model/org/eclipse/jdt/internal/core/builder/impl/OldBuilderType.java index 7d947d4..9f4fac0 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/OldBuilderType.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/OldBuilderType.java
@@ -56,6 +56,6 @@ * For debugging only */ public String toString() { - return "OldBuilderType("/*nonNLS*/ + fOldTSEntry.getType().getName() + ")"/*nonNLS*/; + return "OldBuilderType(" + fOldTSEntry.getType().getName() + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/OrderedSet.java b/model/org/eclipse/jdt/internal/core/builder/impl/OrderedSet.java index a37998d..d2d155b 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/OrderedSet.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/OrderedSet.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.builder.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public class OrderedSet { protected int elementCount; @@ -26,7 +21,7 @@ * Constructs a new OrderedSet using the specified capacity * and the default load factor. * - * @param capacity the initial capacity + * @param capacity the initial capacity */ public OrderedSet (int capacity) { this(capacity, 0.75f); @@ -35,7 +30,7 @@ * Constructs a new OrderedSet using the specified capacity * and load factor. * - * @param loadFactor the initial load factor + * @param loadFactor the initial load factor */ public OrderedSet (int capacity, float loadFactor) { if (capacity <= 0) throw new IllegalArgumentException(); @@ -67,11 +62,11 @@ * Answers the object associated with the specified index in * this OrderedSet. * - * @param index the index to use - * @return the object associated with the specified index + * @param index the index to use + * @return the object associated with the specified index * @throws ArrayIndexOutOfBoundsException if the index is out of range * - * @see #put + * @see #put */ public Object get(int index) { if (index >= elementCount) { @@ -83,10 +78,10 @@ * Answers whether the specified object is in * this OrderedSet. * - * @param obj the object, which must not be null - * @return true if the object is in the set, false otherwise + * @param obj the object, which must not be null + * @return true if the object is in the set, false otherwise * - * @see #put + * @see #put */ public boolean includes(Object obj) { if (obj == null) { @@ -99,11 +94,11 @@ * Answers the index associated with the specified object in * this OrderedSet. * - * @param obj the object, which must not be null - * @return the index associated with the object + * @param obj the object, which must not be null + * @return the index associated with the object * @throws IllegalArgumentException if the key is not in the pool * - * @see #put + * @see #put */ public int index(Object obj) { if (obj == null) { @@ -122,11 +117,11 @@ * But the object is retrievable using get(int index). * The index must not yet have been assigned. * - * @param index the index of the object - * @param obj the object to add + * @param index the index of the object + * @param obj the object to add * - * @see #get - * @see java.lang.Object#equals + * @see #get + * @see java.lang.Object#equals */ public void put(int index, Object obj) { if (obj == null) throw new NullPointerException (); @@ -146,11 +141,11 @@ * Associate the given object with the next index in this OrderedSet. * If the object is already present, its index is unchanged. The object cannot be null. * - * @param obj the object to add - * @return the index associated with the specified obj + * @param obj the object to add + * @return the index associated with the specified obj * - * @see #index - * @see java.lang.Object#equals + * @see #index + * @see java.lang.Object#equals */ public int put (Object obj) { if (obj == null) throw new NullPointerException (); @@ -197,7 +192,7 @@ /** * Answers the number of objects in this OrderedSet. * - * @return the number of objects in this OrderedSet + * @return the number of objects in this OrderedSet */ public int size () { return elementCount; @@ -205,7 +200,7 @@ /** * Answers the string representation of this OrderedSet. * - * @return the string representation of this OrderedSet + * @return the string representation of this OrderedSet */ public String toString () { Object key; @@ -214,7 +209,7 @@ for (int i=0; i<elementCount; i++) { if (i != 0) buffer.append (','); if (buffer.length() > 1000) { - buffer.append("..."/*nonNLS*/); + buffer.append("..."); break; } buffer.append (orderedList[i]);
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/PackageImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/PackageImpl.java index 99c8630..176c8bf 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/PackageImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/PackageImpl.java
@@ -4,22 +4,14 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.builder.IHandle; -import org.eclipse.jdt.internal.core.builder.IImageContext; -import org.eclipse.jdt.internal.core.builder.IPackage; -import org.eclipse.jdt.internal.core.builder.ISourceFragment; -import org.eclipse.jdt.internal.core.builder.IState; -import org.eclipse.jdt.internal.core.builder.IType; -import org.eclipse.jdt.internal.core.builder.NotPresentException; -import org.eclipse.jdt.internal.core.builder.StateSpecificException; +import org.eclipse.jdt.internal.core.builder.*; public class PackageImpl extends NonStateSpecificHandleImpl implements IPackage { JavaDevelopmentContextImpl fDevelopmentContext; String fName; boolean fIsUnnamed; - public static final String DEFAULT_PACKAGE_PREFIX = "Default-"/*nonNLS*/; + public static final String DEFAULT_PACKAGE_PREFIX = "Default-"; /** * Creates a new package * @param name of package @@ -203,9 +195,9 @@ public static String readableName(IPackage pkg) { String name = pkg.getName(); if (pkg.isUnnamed()) { - return Util.bind("build.defaultPackageName"/*nonNLS*/, name.substring(DEFAULT_PACKAGE_PREFIX.length())); + return "default package for " + name.substring(DEFAULT_PACKAGE_PREFIX.length()); } else { - return Util.bind("build.packageName"/*nonNLS*/, name); + return "package " + name; } } /** @@ -213,9 +205,9 @@ * only (NON-NLS). */ public String toString() { - String result = "package "/*nonNLS*/; + String result = "package "; if (isUnnamed()) - result += "{unnamed, id="/*nonNLS*/ + getName() + "}"/*nonNLS*/; + result += "{unnamed, id=" + getName() + "}"; else result += getName(); return result;
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/PackageImplSWH.java b/model/org/eclipse/jdt/internal/core/builder/impl/PackageImplSWH.java index 8bf3a15..79dc190 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/PackageImplSWH.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/PackageImplSWH.java
@@ -5,13 +5,10 @@ * All Rights Reserved. */ import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.builder.IHandle; -import org.eclipse.jdt.internal.core.builder.IImageContext; -import org.eclipse.jdt.internal.core.builder.IPackage; -import org.eclipse.jdt.internal.core.builder.ISourceFragment; -import org.eclipse.jdt.internal.core.builder.IType; -import org.eclipse.jdt.internal.core.builder.NotPresentException; + +import org.eclipse.jdt.internal.core.builder.*; + +import java.util.*; public class PackageImplSWH extends StateSpecificHandleImpl implements IPackage { PackageImpl fHandle; @@ -146,7 +143,7 @@ public IPackage[] getReferencingPackages(IImageContext context) throws NotPresentException { if (!isPresent()) - throw new NotPresentException(Util.bind("element.notPresent"/*nonNLS*/)); + throw new NotPresentException("Not present"); IPackage[] pkgs = fState.getReferencingPackages(fHandle, context);
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/PackageMap.java b/model/org/eclipse/jdt/internal/core/builder/impl/PackageMap.java index 8f88cf2..47d23f4 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/PackageMap.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/PackageMap.java
@@ -112,15 +112,15 @@ IPackage[] pkgs = getAllPackagesAsArray(); Arrays.sort(pkgs, StateImpl.getPackageComparator()); StringBuffer sb = new StringBuffer(); - sb.append(super.toString() + ":\n"/*nonNLS*/); + sb.append(super.toString() + ":\n"); for (int i = 0; i < pkgs.length; ++i) { - sb.append(" "/*nonNLS*/ + pkgs[i].getName() + ": "/*nonNLS*/); + sb.append(" " + pkgs[i].getName() + ": "); IPath[] fragments = getFragments(pkgs[i]); for (int j = 0; j < fragments.length; ++j) { - if (j != 0) sb.append(", "/*nonNLS*/); + if (j != 0) sb.append(", "); sb.append(fragments[j]); } - sb.append("\n"/*nonNLS*/); + sb.append("\n"); } return sb.toString(); }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/PackageMapEntry.java b/model/org/eclipse/jdt/internal/core/builder/impl/PackageMapEntry.java index 6f80669..8c5fdbb 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/PackageMapEntry.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/PackageMapEntry.java
@@ -32,6 +32,7 @@ } else { for (int i = 0; i < fFragments.length; ++i) { if (fFragments[i].equals(fragment)) { + System.out.println("Warning: internal error: attempt to add duplicate package fragment in image builder: " + fragment); return; } } @@ -73,9 +74,9 @@ * This method is for debugging purposes only. */ public String toString() { - StringBuffer buf = new StringBuffer("PackageMapEntry("/*nonNLS*/); + StringBuffer buf = new StringBuffer("PackageMapEntry("); buf.append(fPkg); - buf.append(")"/*nonNLS*/); + buf.append(")"); return buf.toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/PathMap.java b/model/org/eclipse/jdt/internal/core/builder/impl/PathMap.java index 4a85e78..6959bd8 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/PathMap.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/PathMap.java
@@ -4,16 +4,9 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.Vector; - import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.internal.core.Util; import org.eclipse.jdt.internal.core.builder.IPackage; +import java.util.*; import org.eclipse.jdt.internal.core.util.LookupTable; /** @@ -61,10 +54,10 @@ IPackage packageHandleFromPath(IPath path) { IPackage[] pkgs = (IPackage[])fTable.get(path); if (pkgs == null) { - throw new Error(Util.bind("build.noPackagePath"/*nonNLS*/, path.toString())); + throw new Error("Attempt to access packages for non-existent path:" + path); } if (pkgs.length != 1) { - throw new Error(Util.bind("build.ambiguousPackage"/*nonNLS*/, path.toString())); + throw new Error("Didn't get exactly one package for " + path); } return pkgs[0]; } @@ -120,23 +113,23 @@ } Collections.sort(list, StateImpl.getPathComparator()); StringBuffer sb = new StringBuffer(); - sb.append(super.toString() + ":\n"/*nonNLS*/); + sb.append(super.toString() + ":\n"); for (int i = 0; i < list.size(); ++i) { IPath path = (IPath) list.get(i); - sb.append(" "/*nonNLS*/ + path + ": "/*nonNLS*/); + sb.append(" " + path + ": "); IPackage[] pkgs = packageHandlesFromPath(path); if (pkgs.length == 1) { sb.append(pkgs[0].getName()); } else { Arrays.sort(pkgs, StateImpl.getPackageComparator()); - sb.append("("/*nonNLS*/ + pkgs.length + " packages)"/*nonNLS*/); + sb.append("(" + pkgs.length + " packages)"); for (int j = 0; j < pkgs.length; ++j) { - sb.append("\n "/*nonNLS*/); + sb.append("\n "); sb.append(pkgs[j].getName()); } } - sb.append("\n"/*nonNLS*/); + sb.append("\n"); } return sb.toString(); }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/PrimitiveTypeHandleImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/PrimitiveTypeHandleImpl.java index ecf1893..d388f18 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/PrimitiveTypeHandleImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/PrimitiveTypeHandleImpl.java
@@ -98,6 +98,7 @@ sig = 'V'; break; default : + Assert.isTrue(false, "invalid type code"); sig = ' '; } sb.append(sig); @@ -149,24 +150,25 @@ public String getSimpleName() { switch (fTypeCode) { case TC_BOOLEAN : - return "boolean"/*nonNLS*/; + return "boolean"; case TC_BYTE : - return "byte"/*nonNLS*/; + return "byte"; case TC_CHAR : - return "char"/*nonNLS*/; + return "char"; case TC_DOUBLE : - return "double"/*nonNLS*/; + return "double"; case TC_FLOAT : - return "float"/*nonNLS*/; + return "float"; case TC_INT : - return "int"/*nonNLS*/; + return "int"; case TC_LONG : - return "long"/*nonNLS*/; + return "long"; case TC_SHORT : - return "short"/*nonNLS*/; + return "short"; case TC_VOID : - return "void"/*nonNLS*/; + return "void"; default : + Assert.isTrue(false, "invalid type code"); } return null; } @@ -219,25 +221,25 @@ protected static String typeSignature(int typeCode) { switch (typeCode) { case TC_VOID : - return "V"/*nonNLS*/; + return "V"; case TC_BOOLEAN : - return "Z"/*nonNLS*/; + return "Z"; case TC_BYTE : - return "B"/*nonNLS*/; + return "B"; case TC_CHAR : - return "C"/*nonNLS*/; + return "C"; case TC_SHORT : - return "S"/*nonNLS*/; + return "S"; case TC_INT : - return "I"/*nonNLS*/; + return "I"; case TC_LONG : - return "J"/*nonNLS*/; + return "J"; case TC_FLOAT : - return "F"/*nonNLS*/; + return "F"; case TC_DOUBLE : - return "D"/*nonNLS*/; + return "D"; default : - return "unknown"/*nonNLS*/; + return "unknown"; } } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ProblemDetailImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/ProblemDetailImpl.java index 812c532..12d9a9f 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ProblemDetailImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ProblemDetailImpl.java
@@ -197,6 +197,6 @@ * purposes only. Non-NLS. */ public String toString() { - return "ProblemDetail("/*nonNLS*/ + getMessage() + ")"/*nonNLS*/; + return "ProblemDetail(" + getMessage() + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ProblemFactory.java b/model/org/eclipse/jdt/internal/core/builder/impl/ProblemFactory.java index 87c7237..3a373cc 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ProblemFactory.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ProblemFactory.java
@@ -25,7 +25,7 @@ */ private ProblemFactory(Locale locale) { fLocale = locale; - fCompilerResources = ResourceBundle.getBundle("org.eclipse.jdt.internal.compiler.problem.Messages"/*nonNLS*/, locale); + fCompilerResources = ResourceBundle.getBundle("org.eclipse.jdt.internal.compiler.problem.Messages", locale); //$NON-NLS-1$ initializeMessageTemplates(); } /** @@ -53,7 +53,7 @@ StringBuffer output = new StringBuffer(80); String message = fMessageTemplates[ (id & ProblemIrritants.IgnoreCategoriesMask)]; if (message == null) { - return "Unable to retrieve the error message for problem id: "/*nonNLS*/+ id + ". Check compiler resources."/*nonNLS*/; + return "Unable to retrieve the error message for problem id: " + id + ". Check compiler resources."; } int length = message.length(); int start = -1, end = length; @@ -66,7 +66,7 @@ } catch (NumberFormatException nfe) { output.append(message.substring(end + 1, start + 1)); } catch (ArrayIndexOutOfBoundsException e) { - return "Corrupted compiler resources for problem id: "/*nonNLS*/ + (id & ProblemIrritants.IgnoreCategoriesMask) + ". Check compiler resources."/*nonNLS*/; + return "Corrupted compiler resources for problem id: " + (id & ProblemIrritants.IgnoreCategoriesMask) + ". Check compiler resources."; } } else { output.append(message.substring(end, length)); @@ -98,7 +98,7 @@ fMessageTemplates = new String[500]; for (int i = 0; i < fMessageTemplates.length; i++) { try { - fMessageTemplates[i] = fCompilerResources.getString(String.valueOf(i)); + fMessageTemplates[i] = fCompilerResources.getString(String.valueOf(i)); //$NON-NLS-1$ } catch (MissingResourceException e) { } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ProblemTable.java b/model/org/eclipse/jdt/internal/core/builder/impl/ProblemTable.java index 3b7e49c..289b474 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ProblemTable.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ProblemTable.java
@@ -170,12 +170,12 @@ * @return a string representation of the receiver */ public String toString() { - StringBuffer buf = new StringBuffer("ProblemTable(\n\t"/*nonNLS*/); - buf.append("type problems: "/*nonNLS*/); + StringBuffer buf = new StringBuffer("ProblemTable(\n\t"); + buf.append("type problems: "); buf.append(fTable); - buf.append("\n\timage problems: "/*nonNLS*/); + buf.append("\n\timage problems: "); buf.append(fImageProblems); - buf.append(")"/*nonNLS*/); + buf.append(")"); return buf.toString(); }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ProjectBinaryOutput.java b/model/org/eclipse/jdt/internal/core/builder/impl/ProjectBinaryOutput.java index 2f891ae..817ead2 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ProjectBinaryOutput.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ProjectBinaryOutput.java
@@ -29,6 +29,10 @@ private IPath outputPath; private JavaDevelopmentContextImpl dc; + public final static String ADDED = "ADDED"; + public final static String MODIFIED = "MODIFIED"; + public final static String DELETED = "DELETED"; + /** * Creates a new ProjectBinaryOutput for the given project and output path * in this project. @@ -103,7 +107,7 @@ IResource resource = (IResource) members[i]; switch (resource.getType()) { case IResource.FILE : - if (resource.getName().toLowerCase().endsWith(".class"/*nonNLS*/)) { + if (resource.getName().toLowerCase().endsWith(".class")) { resource.delete(true, null); } break; @@ -175,7 +179,7 @@ * Returns the path in the output folder for the given type. */ private IPath getPathForBinary(IType type) { - return getOutputPath().append(type.getName().replace('.', '/') + ".class"/*nonNLS*/); + return getOutputPath().append(type.getName().replace('.', '/') + ".class"); } /** * Returns the container at the given path, creating it and any parent folders if necessary.
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ProjectResourceCopier.java b/model/org/eclipse/jdt/internal/core/builder/impl/ProjectResourceCopier.java index 628a236..6180ae0 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ProjectResourceCopier.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ProjectResourceCopier.java
@@ -5,21 +5,12 @@ * All Rights Reserved. */ -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.core.Util; +import org.eclipse.core.resources.*; +import org.eclipse.core.runtime.*; + +import org.eclipse.jdt.core.*; + +import java.util.*; public class ProjectResourceCopier implements IResourceVisitor { @@ -65,7 +56,7 @@ if (this.outputLocation.equals(this.sourceFolders[i].getFullPath())) continue; // do nothing if output is same as source folder if (!hasNotified){ hasNotified = true; - if (notifier != null) notifier.subTask(Util.bind("build.copyingResources"/*nonNLS*/)); + if (notifier != null) notifier.subTask("Copying all resources on the classpath"); } this.sourceFolders[i].accept(this); } @@ -87,7 +78,7 @@ switch (resource.getType()){ case IResource.FILE : if (sourceFolderPath == null) return false; // resource is not inside the classpath - if (!"java"/*nonNLS*/.equals(resource.getFileExtension())){ // ignore source files + if (!"java".equals(resource.getFileExtension())){ // ignore source files IFile currentFile = (IFile) resource; IPath pathSuffix = resourcePath.removeFirstSegments(sourceFolderPath.segmentCount()); @@ -140,7 +131,7 @@ switch (resource.getType()){ case IResource.FILE : - if (!"java"/*nonNLS*/.equals(resource.getFileExtension())){ // ignore source files + if (!"java".equals(resource.getFileExtension())){ // ignore source files IFile currentFile = (IFile) resource; pathSuffix = resourcePath.removeFirstSegments(sourceFolderPath.segmentCount()); @@ -149,6 +140,7 @@ IFile previousFile = this.root.getFile(targetPath); if (previousFile.exists()) previousFile.delete(true, true, null); } catch(CoreException e){ + //throw this.devContext.internalException(e); } } break; @@ -161,6 +153,7 @@ try { targetFolder.delete(true, false, null); } catch(CoreException e){ + //throw this.devContext.internalException(e); } } break; @@ -195,7 +188,7 @@ if (this.outputLocation.equals(this.sourceFolders[i].getFullPath())) continue; // do nothing if output is same as source folder if (!hasNotified){ hasNotified = true; - if (notifier != null) notifier.subTask(Util.bind("build.updatingResources"/*nonNLS*/)); + if (notifier != null) notifier.subTask("Updating resources on the classpath"); } } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ReportCardImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/ReportCardImpl.java index 10bef72..f2728f8 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ReportCardImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ReportCardImpl.java
@@ -104,7 +104,7 @@ if (path.isPrefixOf(sEntryPath)) { String extension = sEntryPath.getFileExtension(); // test most frequent cases first - if (extension != null && (extension.toLowerCase().equals("java"/*nonNLS*/) || extension.toLowerCase().equals("class"/*nonNLS*/))) { + if (extension != null && (extension.toLowerCase().equals("java") || extension.toLowerCase().equals("class"))) { getProblemsForSourceEntry(sEntry, vResults); } else { if (fState.isZipElement(sEntryPath)) {
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/SourceElementTable.java b/model/org/eclipse/jdt/internal/core/builder/impl/SourceElementTable.java index 48067b1..8d8446a 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/SourceElementTable.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/SourceElementTable.java
@@ -75,6 +75,7 @@ Assert.isTrue(!pkg.isStateSpecific()); LookupTable pkgTable = getPackageTable(pkg); if (pkgTable != null) { + Assert.isTrue(fileName.indexOf('.') != -1, "name must have extension"); return (SourceEntry) pkgTable.get(fileName); } return null; @@ -123,6 +124,6 @@ * @return a string representation of the receiver */ public String toString() { - return "SourceElementTable("/*nonNLS*/ + fPackageTable + ")"/*nonNLS*/; + return "SourceElementTable(" + fPackageTable + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/SourceEntry.java b/model/org/eclipse/jdt/internal/core/builder/impl/SourceEntry.java index d42409f..b90a098 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/SourceEntry.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/SourceEntry.java
@@ -94,7 +94,7 @@ return s.replace('/', File.separatorChar); } public String getZipEntryName() { - return fZipEntryPath == null ? fZipEntryFileName : fZipEntryPath + "/"/*nonNLS*/ + fZipEntryFileName; + return fZipEntryPath == null ? fZipEntryFileName : fZipEntryPath + "/" + fZipEntryFileName; } public int hashCode() { int code = fPath.hashCode(); @@ -112,10 +112,10 @@ */ public boolean isBinary() { if (fZipEntryFileName != null) { - return fZipEntryFileName.endsWith(".class"/*nonNLS*/); + return fZipEntryFileName.endsWith(".class"); } String extension = fPath.getFileExtension(); - return extension != null && extension.equalsIgnoreCase("class"/*nonNLS*/); + return extension != null && extension.equalsIgnoreCase("class"); } /** * Returns true if the source entry comes from a compilation unit, otherwise @@ -123,16 +123,16 @@ */ public boolean isSource() { if (fZipEntryFileName != null) { - return fZipEntryFileName.endsWith(".java"/*nonNLS*/); + return fZipEntryFileName.endsWith(".java"); } String extension = fPath.getFileExtension(); - return extension != null && extension.equalsIgnoreCase("java"/*nonNLS*/); + return extension != null && extension.equalsIgnoreCase("java"); } /** * Returns a String that represents the value of this object. * @return a string representation of the receiver */ public String toString() { - return fZipEntryFileName == null ? fPath.toString() : fPath.toString() + ", entry: "/*nonNLS*/ + this.getZipEntryName(); + return fZipEntryFileName == null ? fPath.toString() : fPath.toString() + ", entry: " + this.getZipEntryName(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/SourceFragmentImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/SourceFragmentImpl.java index 76a1bf4..3ed0bf8 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/SourceFragmentImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/SourceFragmentImpl.java
@@ -62,7 +62,7 @@ */ public String toString() { return - "SourceFragmentImpl("/*nonNLS*/ + fPath - + (fZipEntryName == null ? ""/*nonNLS*/ : " : "/*nonNLS*/ + fZipEntryName) + ")"/*nonNLS*/; + "SourceFragmentImpl(" + fPath + + (fZipEntryName == null ? "" : " : " + fZipEntryName) + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/StateImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/StateImpl.java index 0dce2cd..2f8a414 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/StateImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/StateImpl.java
@@ -4,65 +4,35 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Comparator; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Random; -import java.util.Vector; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClassFile; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; + +import org.eclipse.core.resources.*; + +import org.eclipse.core.resources.*; +import org.eclipse.jdt.internal.core.builder.*; + +import java.io.*; +import java.util.*; +import java.util.zip.*; + import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.internal.compiler.env.*; +import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.internal.compiler.*; +import org.eclipse.jdt.core.IClassFile; + +import org.eclipse.jdt.internal.core.util.*; +import org.eclipse.jdt.internal.compiler.classfmt.*; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.core.runtime.*; +import org.eclipse.jdt.internal.compiler.util.*; +import org.eclipse.jdt.internal.core.lookup.*; +import org.eclipse.jdt.internal.core.*; import org.eclipse.jdt.internal.compiler.ClassFile; -import org.eclipse.jdt.internal.compiler.CompilationResult; -import org.eclipse.jdt.internal.compiler.ConfigurableOption; -import org.eclipse.jdt.internal.compiler.IProblem; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; -import org.eclipse.jdt.internal.compiler.env.IBinaryType; -import org.eclipse.jdt.internal.core.CompilationUnit; -import org.eclipse.jdt.internal.core.JavaModelManager; -import org.eclipse.jdt.internal.core.JavaProject; -import org.eclipse.jdt.internal.core.PackageFragment; -import org.eclipse.jdt.internal.core.PackageFragmentRoot; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.builder.BinaryBrokerKey; -import org.eclipse.jdt.internal.core.builder.IDelta; -import org.eclipse.jdt.internal.core.builder.IDependencyGraph; -import org.eclipse.jdt.internal.core.builder.IDevelopmentContext; -import org.eclipse.jdt.internal.core.builder.IImage; -import org.eclipse.jdt.internal.core.builder.IImageBuilder; -import org.eclipse.jdt.internal.core.builder.IImageContext; -import org.eclipse.jdt.internal.core.builder.IPackage; -import org.eclipse.jdt.internal.core.builder.IProblemDetail; -import org.eclipse.jdt.internal.core.builder.IProblemReporter; -import org.eclipse.jdt.internal.core.builder.IReportCard; -import org.eclipse.jdt.internal.core.builder.IState; -import org.eclipse.jdt.internal.core.builder.IType; -import org.eclipse.jdt.internal.core.builder.NotPresentException; -import org.eclipse.jdt.internal.core.builder.StateSpecificException; -import org.eclipse.jdt.internal.core.lookup.ReferenceInfo; -import org.eclipse.jdt.internal.core.util.LookupTable; /** * The concrete representation of a built state. @@ -198,7 +168,7 @@ /** * Name for namespace node representing unknown dependencies. */ - private static final String UNKNOWN_DEPENDENCIES= "$UNKNOWN_DEPENDENCIES$"/*nonNLS*/; + private static final String UNKNOWN_DEPENDENCIES= "$UNKNOWN_DEPENDENCIES$"; /** * Random number generator, used for generating fingerprints. @@ -425,7 +395,7 @@ String className= Util.toString(classFile.getCompoundName()); if (classFile == null) { // Could not discover principal structure - String msg= Util.bind("build.errorParsingBinary"/*nonNLS*/, className); + String msg= "Error parsing binary for " + className; ProblemDetailImpl problem= new ProblemDetailImpl(msg, sEntry); vProblems.addElement(problem); // skip it @@ -444,7 +414,7 @@ if (!typePkg.isUnnamed()) { path= path.append(typePkg.getName().replace('.', IPath.SEPARATOR)); } - String msg= Util.bind("build.packageMismatch"/*nonNLS*/, path.toString()); + String msg= "Package declaration does not match folder. Expected folder is " + path + "."; ProblemDetailImpl problem= new ProblemDetailImpl(msg, 0, IProblemDetail.S_ERROR, sEntry, 0, 0, 1); vProblems.addElement(problem); // Only report the conflict once (there may be several types, but there's only one package declaration). @@ -544,7 +514,7 @@ } if (lazyBuildCU && binaryType == null) { /* couldn't parse the class file */ - ProblemDetailImpl problem= new ProblemDetailImpl(Util.bind("build.errorParsingBinary"/*nonNLS*/, type.getName()), sEntry); + ProblemDetailImpl problem= new ProblemDetailImpl("unable to parse class file: " + type.getName(), sEntry); fProblemReporter.putProblem(sEntry, problem); } return binaryType; @@ -658,7 +628,7 @@ /* rebuild descriptor from indexes or binary */ IBinaryType binaryType= forceBinaryType(tsEntry, false); // Use false for 1FVQGL1: ITPJCORE:WINNT - SEVERE - Error saving java file if (binaryType == null) { - throw new NotPresentException(Util.bind("build.errorBuildingType"/*nonNLS*/, tsEntry.getSourceEntry().getFileName())); + throw new NotPresentException("Unable to build type: " + tsEntry.getSourceEntry().getFileName()); } return binaryType; } @@ -723,7 +693,7 @@ if (!fSourceElementTable.containsPackage(pkg)) { getSourceEntries(pkg); } - SourceEntry entry= fSourceElementTable.getSourceEntry(pkg, simpleName + ".java"/*nonNLS*/); + SourceEntry entry= fSourceElementTable.getSourceEntry(pkg, simpleName + ".java"); if (entry == null) return null; return new PackageElement(pkg, entry); @@ -776,24 +746,32 @@ JavaModelManager manager= (JavaModelManager) JavaModelManager.getJavaModelManager(); zipFile= manager.getZipFile(path); if (zipFile == null) { + //throw internalException("Error reading file " + entry + "due to missing zip/jar file"); return new byte[0]; } ZipEntry zipEntry= zipFile.getEntry(entry.getZipEntryName()); if (zipEntry == null) { + //throw internalException("Error reading file " + entry + " due to missing zip/jar entry"); return new byte[0]; } InputStream input= zipFile.getInputStream(zipEntry); if (input == null){ + //throw internalException("Error reading file " + entry + " due to missing zip/jar entry"); return new byte[0]; } byte[] contents= Util.readContentsAsBytes(input); if (contents == null) { + //throw internalException("Error reading file " + entry + " due to error reading contents"); return new byte[0]; } return contents; } catch (CoreException e) { + //throw internalException(e); return new byte[0]; } catch (IOException e) { + String message= e.getMessage(); + message= (message == null ? "." : " due to " + message + "."); + //throw internalException("Error reading file " + entry + message); return new byte[0]; } finally { if (zipFile != null) { @@ -814,7 +792,8 @@ return fDevelopmentContext.getBinaryFromFileSystem(file); } catch (IOException e) { String message= e.getMessage(); - message= (message == null ? "."/*nonNLS*/ : " due to "/*nonNLS*/ + message + "."/*nonNLS*/); + message= (message == null ? "." : " due to " + message + "."); + //throw internalException("Error reading file " + entry + message); return new byte[0]; } } @@ -852,7 +831,9 @@ } catch(IOException ioe) { } } - return new char[0]; + String message= e.getMessage(); + message= (message == null ? "." : " due to " + message + "."); + throw internalException("Error reading file " + entry + message); } } /** @@ -931,7 +912,7 @@ } } if (frag == null) { - throw internalException(Util.bind("build.missingFile"/*nonNLS*/, sEntry.toString())); + throw internalException("Missing file for " + sEntry); } String fileName= sEntry.getPath().lastSegment(); if (sEntry.isSource()) { @@ -1118,6 +1099,7 @@ try { return ((CompilationUnit)unit).getReferenceInfo(); } catch (JavaModelException e) { + System.out.println("Caught not present exception for unit: " + unit + e); return null; } } @@ -1219,9 +1201,9 @@ ICompilationUnit unit= units[i]; String fileName= unit.getElementName(); // get the corresponding .class file name - String classFileName = ""/*nonNLS*/; + String classFileName = ""; if (Util.isJavaFileName(fileName)) { // paranoia check - classFileName = fileName.substring(0, fileName.length()-5).concat(".class"/*nonNLS*/); + classFileName = fileName.substring(0, fileName.length()-5).concat(".class"); } // see if a source entry exists for this file name // or for the corresponding .class file @@ -1245,7 +1227,7 @@ String fileName= classFile.getElementName(); // get the corresponding .java file name // note: this handles nested types, but not secondary types (e.g. class B defined in A.java) - String javaFileName = ""/*nonNLS*/; + String javaFileName = ""; if (Util.isClassFileName(fileName)) { // paranoia check // strip off any nested types javaFileName = fileName.substring(0, fileName.length()-6); @@ -1253,7 +1235,7 @@ if (dol != -1) { javaFileName = javaFileName.substring(0, dol); } - javaFileName = javaFileName.concat(".java"/*nonNLS*/); + javaFileName = javaFileName.concat(".java"); } // see if a source entry exists for this file name // or for the corresponding .java file @@ -1315,7 +1297,7 @@ protected SourceEntry getSourceEntry(String qualifiedNameWithSuffix) { int dot= qualifiedNameWithSuffix.lastIndexOf('.'); dot= qualifiedNameWithSuffix.lastIndexOf('.', dot - 1); - String pkgName= (dot == -1 ? ".default"/*nonNLS*/ : qualifiedNameWithSuffix.substring(0, dot)); + String pkgName= (dot == -1 ? ".default" : qualifiedNameWithSuffix.substring(0, dot)); String fileName= (dot == -1 ? qualifiedNameWithSuffix : qualifiedNameWithSuffix.substring(dot + 1)); IPackage pkg= fDevelopmentContext.getImage().getPackageHandle(pkgName, false); getSourceEntries(pkg); // force @@ -1344,16 +1326,16 @@ getSourceEntries(pkg); } String simpleName= type.getSimpleName(); - SourceEntry entry= fSourceElementTable.getSourceEntry(pkg, simpleName + ".java"/*nonNLS*/); + SourceEntry entry= fSourceElementTable.getSourceEntry(pkg, simpleName + ".java"); if (entry == null) { - entry= fSourceElementTable.getSourceEntry(pkg, simpleName + ".class"/*nonNLS*/); + entry= fSourceElementTable.getSourceEntry(pkg, simpleName + ".class"); if (entry == null) { int firstDollar= simpleName.indexOf('$'); if (firstDollar != -1) { simpleName= simpleName.substring(0, firstDollar); - entry= fSourceElementTable.getSourceEntry(pkg, simpleName + ".java"/*nonNLS*/); + entry= fSourceElementTable.getSourceEntry(pkg, simpleName + ".java"); if (entry == null) { - entry= fSourceElementTable.getSourceEntry(pkg, simpleName + ".class"/*nonNLS*/); + entry= fSourceElementTable.getSourceEntry(pkg, simpleName + ".class"); } } } @@ -1452,7 +1434,7 @@ */ protected TypeStructureEntry getTypeStructureEntry(String qualifiedNameWithoutSuffix) { int dot= qualifiedNameWithoutSuffix.lastIndexOf('.'); - String pkgName= (dot == -1 ? ".default"/*nonNLS*/ : qualifiedNameWithoutSuffix.substring(0, dot)); + String pkgName= (dot == -1 ? ".default" : qualifiedNameWithoutSuffix.substring(0, dot)); String typeName= (dot == -1 ? qualifiedNameWithoutSuffix : qualifiedNameWithoutSuffix.substring(dot + 1)); IPackage pkg= fDevelopmentContext.getImage().getPackageHandle(pkgName, false); IType type= pkg.getClassHandle(typeName); @@ -1532,7 +1514,7 @@ */ protected static boolean isZipElement(IPath path) { String extension= path.getFileExtension(); - return extension != null && (extension.equalsIgnoreCase("zip"/*nonNLS*/) || extension.equalsIgnoreCase("jar"/*nonNLS*/)); + return extension != null && (extension.equalsIgnoreCase("zip") || extension.equalsIgnoreCase("jar")); } /** * Given a project-relative path, returns an absolute path. @@ -1618,7 +1600,7 @@ if (tsExisting != null) { if (!tsExisting.getSourceEntry().getFileName().equals(sEntry.getFileName())) { // Same type provided by different files - String msg= Util.bind("build.duplicateType"/*nonNLS*/, typeHandle.getName(), tsExisting.getSourceEntry().getFileName()); + String msg= "Type " + typeHandle.getName() + " already provided by " + tsExisting.getSourceEntry().getFileName(); ProblemDetailImpl problem= new ProblemDetailImpl(msg, sEntry); fProblemReporter.putProblem(sEntry, problem); // skip it @@ -1816,7 +1798,7 @@ * Returns a string representation of the receiver. */ public String toString() { - return "StateImpl("/*nonNLS*/ + fStateNumber + ")"/*nonNLS*/; + return "StateImpl(" + fStateNumber + ")"; } /** * Returns the type handle for the given type name,
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/StateSnap.java b/model/org/eclipse/jdt/internal/core/builder/impl/StateSnap.java index 52fcb91..7ab1aa8 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/StateSnap.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/StateSnap.java
@@ -4,14 +4,12 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.Hashtable; - import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.builder.IPackage; + +import org.eclipse.jdt.internal.core.builder.*; + +import java.io.*; +import java.util.*; /** * This class takes and restores snapshots of a State. @@ -75,7 +73,7 @@ int magic = in.readInt(); int version = in.readShort(); if (magic != MAGIC) { // magic = "STAT"e - throw new IOException(Util.bind("build.wrongFileFormat"/*nonNLS*/)); + throw new IOException("Unrecognized format"); } /* dispatch to appropriate reader */ @@ -85,7 +83,7 @@ case VERSION6: return new StateSnapV6().read(dc, project, in); default: - throw new IOException(Util.bind("build.unhandledVersionFormat"/*nonNLS*/)); + throw new IOException("Unrecognized state format"); } } /**
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/StateSnapConstantPool.java b/model/org/eclipse/jdt/internal/core/builder/impl/StateSnapConstantPool.java index 7584b6f..c03075b 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/StateSnapConstantPool.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/StateSnapConstantPool.java
@@ -4,22 +4,12 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; +import org.eclipse.core.runtime.*; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; import org.eclipse.jdt.internal.core.Assert; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.builder.IConstructor; -import org.eclipse.jdt.internal.core.builder.IDevelopmentContext; -import org.eclipse.jdt.internal.core.builder.IField; -import org.eclipse.jdt.internal.core.builder.IHandle; -import org.eclipse.jdt.internal.core.builder.IImage; -import org.eclipse.jdt.internal.core.builder.IMethod; -import org.eclipse.jdt.internal.core.builder.IPackage; -import org.eclipse.jdt.internal.core.builder.IType; +import org.eclipse.jdt.internal.core.builder.*; + +import java.io.*; class StateSnapConstantPool { OrderedSet fSet; @@ -114,14 +104,14 @@ // NOP break; default: - Assert.isTrue(false, "Unknown kind of handle"/*nonNLS*/); + Assert.isTrue(false, "Unknown kind of handle"); } } /** * Add a SourceEntry to the pool. */ public void add(SourceEntry entry) { - Assert.isNotNull(entry, "Null SourceEntry being added to StateSnapConstantPool"/*nonNLS*/); + Assert.isNotNull(entry, "Null SourceEntry being added to StateSnapConstantPool"); if (!fSet.includes(entry)) { add(entry.getPath()); String zipEntryPath = entry.fZipEntryPath; @@ -171,12 +161,12 @@ try { IHandle result = (IHandle)fSet.get(index); if (result == null) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } return result; } catch (ClassCastException e) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } } /** @@ -192,12 +182,12 @@ try { IPackage result = (IPackage)fSet.get(index); if (result == null) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } return result; } catch (ClassCastException e) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } } /** @@ -207,12 +197,12 @@ try { IPath result = (IPath)fSet.get(index); if (result == null) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } return result; } catch (ClassCastException e) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } } /** @@ -222,12 +212,12 @@ try { SourceEntry result = (SourceEntry)fSet.get(index); if (result == null) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } return result; } catch (ClassCastException e) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } } /** @@ -237,12 +227,12 @@ try { String result = (String)fSet.get(index); if (result == null) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } return result; } catch (ClassCastException e) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } } /** @@ -263,7 +253,7 @@ return result; } else { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } } /** @@ -273,12 +263,12 @@ try { IType result = (IType)fSet.get(index); if (result == null) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } return result; } catch (ClassCastException e) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Error in format"); } } /** @@ -306,10 +296,10 @@ ++nN; } else { - Assert.isTrue(false, "Unexpected pool item"/*nonNLS*/); + Assert.isTrue(false, "Unexpected pool item"); } } - return "nStr="/*nonNLS*/ + nStr + ", nID="/*nonNLS*/ + nID + ", nSE="/*nonNLS*/ + nSE + ", nH="/*nonNLS*/ + nH + ",nN="/*nonNLS*/ + nN; + return "nStr=" + nStr + ", nID=" + nID + ", nSE=" + nSE + ", nH=" + nH + ",nN=" + nN; } /** @@ -323,7 +313,7 @@ return fSet.index(obj); } catch (IllegalArgumentException e) { - throw new IllegalArgumentException("Internal error in state serialization. Expected object missing from constant pool: "/*nonNLS*/ + obj); + throw new IllegalArgumentException("Internal error in state serialization. Expected object missing from constant pool: " + obj); } } /** @@ -397,7 +387,7 @@ fSet.put(i, readNumber(in, tag)); break; default: - throw new IOException("Unexpected kind of pool item"/*nonNLS*/); + throw new IOException("Unexpected kind of pool item"); } } } @@ -415,7 +405,7 @@ case 5: { // primitive type // Should not occur since primitive types are well known and not written - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Internal error"); } case 6: { // array type @@ -433,7 +423,7 @@ // method IType declaringClass = getType(in.readInt()); if (declaringClass.isPrimitive() || declaringClass.isArray()) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Bad format"); } String name = getString(in.readInt()); int numParams = in.readByte() & 0xFF; @@ -447,7 +437,7 @@ // constructor IType declaringClass = getType(in.readInt()); if (declaringClass.isPrimitive() || declaringClass.isArray()) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Bad format"); } int numParams = in.readByte() & 0xFF; IType[] params = new IType[numParams]; @@ -460,7 +450,7 @@ // field IType declaringClass = getType(in.readInt()); if (declaringClass.isPrimitive() || declaringClass.isArray()) { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Bad format"); } String name = getString(in.readInt()); return declaringClass.getFieldHandle(name); @@ -469,7 +459,7 @@ // image return dc.getImage(); default: - throw new IOException("Unexpected kind of pool item"/*nonNLS*/); + throw new IOException("Unexpected kind of pool item"); } } /** @@ -490,7 +480,7 @@ // Double return new Double(Double.longBitsToDouble(in.readLong())); default: - throw new IOException("Unexpected type of number"/*nonNLS*/); + throw new IOException("Unexpeced kind of Number"); } } /** @@ -539,7 +529,7 @@ writeNumber((Number)obj, out); // tags 12 through 15 } else { - Assert.isTrue(false, "Unexpected kind of pool item"/*nonNLS*/); + Assert.isTrue(false, "Unexpected pool item"); } } } @@ -559,7 +549,7 @@ if (t.isPrimitive()) { // tag=5 // Primitive types should not show up since they are well known and are not written. - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Internal error"); } else if (t.isArray()) { ArrayTypeHandleImpl at = (ArrayTypeHandleImpl)t; @@ -611,7 +601,7 @@ out.writeByte(11); break; default: - Assert.isTrue(false, "Unknown kind of handle"/*nonNLS*/); + Assert.isTrue(false, "Unknown handle type"); } } /** @@ -635,7 +625,7 @@ out.writeLong(Double.doubleToLongBits(num.doubleValue())); } else { - Assert.isTrue(false, "Unexpected type of number"/*nonNLS*/); + Assert.isTrue(false, "Unexpeced kind of Number"); } } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/StateSnapV5.java b/model/org/eclipse/jdt/internal/core/builder/impl/StateSnapV5.java index e7f9d4f..202d036 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/StateSnapV5.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/StateSnapV5.java
@@ -4,26 +4,18 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.*; + import org.eclipse.jdt.internal.core.Assert; -import org.eclipse.jdt.internal.core.JavaModelManager; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.builder.IDevelopmentContext; -import org.eclipse.jdt.internal.core.builder.IImageContext; -import org.eclipse.jdt.internal.core.builder.IPackage; -import org.eclipse.jdt.internal.core.builder.IProblemReporter; -import org.eclipse.jdt.internal.core.builder.IState; -import org.eclipse.jdt.internal.core.builder.IType; +import org.eclipse.jdt.internal.core.builder.*; import org.eclipse.jdt.internal.core.util.LookupTable; +import java.io.*; +import java.util.*; + +import org.eclipse.jdt.internal.core.JavaModelManager; + /** * StateSnap for state file format version 5. * @see StateSnap @@ -75,7 +67,7 @@ pool.add(((ZipNode)node).getZipFile()); break; default: - Assert.isTrue(false, "Unexpected kind of node"/*nonNLS*/); + Assert.isTrue(false, "Unexpected kind of node"); } // Don't need to process node dependents here, since they're nodes as well // and will have their info added to the pool above. @@ -153,7 +145,7 @@ pool.add(tsEntry.getType()); } protected void badFormat() throws IOException { - throw new IOException("Error in format"/*nonNLS*/); + throw new IOException("Bad format"); } /** * Check that the next section has the given name. @@ -202,7 +194,7 @@ * Read the build context. */ protected IImageContext readBuildContext(IDevelopmentContext dc, StateSnapConstantPool pool, DataInputStream in) throws IOException { - checkSection(in, "BuildContext"/*nonNLS*/); + checkSection(in, "BuildContext"); int numPkgs = in.readInt(); if (numPkgs == -1) { return null; @@ -218,7 +210,7 @@ * The state is needed to create CompilationUnit objects from SourceEntry objects. */ protected DependencyGraph readDependencyGraph(StateSnapConstantPool pool, DataInputStream in, StateImpl state) throws IOException { - checkSection(in, "DependencyGraph"/*nonNLS*/); + checkSection(in, "DependencyGraph"); DependencyGraph graph = new DependencyGraph(); // Avoid creating package elements for each node and dependency. @@ -268,7 +260,7 @@ * Read the package map. */ protected PackageMap readPackageMap(StateSnapConstantPool pool, DataInputStream in) throws IOException { - checkSection(in, "PackageMap"/*nonNLS*/); + checkSection(in, "PackageMap"); PackageMap map = new PackageMap(); int size = in.readInt(); for (int i = 0; i < size; ++i) { @@ -286,7 +278,7 @@ * Read the principal structure table. */ protected Hashtable readPrincipalStructureTable(StateSnapConstantPool pool, DataInputStream in, StateImpl state) throws IOException { - checkSection(in, "PrincipalStructureTable"/*nonNLS*/); + checkSection(in, "PrincipalStructureTable"); int numEntries = in.readInt(); Hashtable table = new Hashtable(numEntries * 2 + 1); for (int i = 0; i < numEntries; ++i) { @@ -314,7 +306,7 @@ * Read the problem reporter. */ protected IProblemReporter readProblemReporter(IProject project, StateSnapConstantPool pool, DataInputStream in) throws IOException { - checkSection(in, "Problems"/*nonNLS*/); + checkSection(in, "Problems"); IProblemReporter reporter = null; boolean isProblemTable = in.readBoolean(); if (isProblemTable) { @@ -330,14 +322,14 @@ try { clazz = Class.forName(className); } catch (ClassNotFoundException e) { - throw new IOException("Class "/*nonNLS*/ + className + " was not found."/*nonNLS*/); + throw new IOException("Class " + className + " was not found."); } try { reporter = (IProblemReporter) clazz.newInstance(); } catch (InstantiationException e) { - throw new IOException("Could not instanciate "/*nonNLS*/ + clazz.getName()); + throw new IOException("Could not instanciate " + clazz.getName()); } catch (IllegalAccessException e) { - throw new IOException("Could not instanciate "/*nonNLS*/ + clazz.getName()); + throw new IOException("Could not instanciate " + clazz.getName()); } reporter.initialize(project, JavaModelManager.getJavaModelManager().getDevelopmentContext(project)); } @@ -347,7 +339,7 @@ * Read the source element table. */ protected SourceElementTable readSourceElementTable(StateSnapConstantPool pool, DataInputStream in) throws IOException { - checkSection(in, "SourceElementTable"/*nonNLS*/); + checkSection(in, "SourceElementTable"); SourceElementTable table = new SourceElementTable(); int numPackages = in.readInt(); for (int i = 0; i < numPackages; ++i) { @@ -476,7 +468,7 @@ * Write the build context. */ protected void writeBuildContext(StateImpl state, StateSnapConstantPool pool, DataOutputStream out) throws IOException { - out.writeUTF("BuildContext"/*nonNLS*/); + out.writeUTF("BuildContext"); IImageContext ctx = state.getBuildContext(); if (ctx == null) { out.writeInt(-1); @@ -493,7 +485,7 @@ * Write the dependency graph. */ protected void writeDependencyGraph(StateImpl state, StateSnapConstantPool pool, DataOutputStream out) throws IOException { - out.writeUTF("DependencyGraph"/*nonNLS*/); + out.writeUTF("DependencyGraph"); DependencyGraph graph = state.getInternalDependencyGraph(); graph.integrityCheck(); /** @@ -508,7 +500,7 @@ out.writeBoolean(true); SourceEntry sEntry = state.getSourceEntry(jcu.getPackageElement()); if (sEntry == null) { - System.out.println("Warning: StatSnap: Attempt to serialize dependency graph node for missing JCU: "/*nonNLS*/ + jcu.getPackageElement() + ". Skipping..."/*nonNLS*/); + System.out.println("Warning: StatSnap: Attempt to serialize dependency graph node for missing JCU: " + jcu.getPackageElement() + ". Skipping..."); } else { Assert.isNotNull(sEntry); out.writeInt(pool.index(sEntry)); @@ -572,7 +564,7 @@ * Write the package map. */ protected void writePackageMap(StateImpl state, StateSnapConstantPool pool, DataOutputStream out) throws IOException { - out.writeUTF("PackageMap"/*nonNLS*/); + out.writeUTF("PackageMap"); PackageMap map = state.getPackageMap(); out.writeInt(map.size()); int count = 0; @@ -592,7 +584,7 @@ * Write the principal structure table. */ protected void writePrincipalStructureTable(StateImpl state, StateSnapConstantPool pool, DataOutputStream out) throws IOException { - out.writeUTF("PrincipalStructureTable"/*nonNLS*/); + out.writeUTF("PrincipalStructureTable"); Hashtable table = state.getPrincipalStructureTable(); int num = table.size(); out.writeInt(num); @@ -621,7 +613,7 @@ * Write the problem reporter. */ protected void writeProblemReporter(StateImpl state, StateSnapConstantPool pool, DataOutputStream out) throws IOException { - out.writeUTF("Problems"/*nonNLS*/); + out.writeUTF("Problems"); IProblemReporter reporter = state.getProblemReporter(); if (reporter instanceof ProblemTable) { out.writeBoolean(true); @@ -645,7 +637,7 @@ * Write the source element table. */ protected void writeSourceElementTable(StateImpl state, StateSnapConstantPool pool, DataOutputStream out) throws IOException { - out.writeUTF("SourceElementTable"/*nonNLS*/); + out.writeUTF("SourceElementTable"); SourceElementTable table = state.getSourceElementTable(); int num = table.numPackages(); out.writeInt(num);
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/TypeCollaboratorIndictment.java b/model/org/eclipse/jdt/internal/core/builder/impl/TypeCollaboratorIndictment.java index 622b1e5..f9c2dc2 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/TypeCollaboratorIndictment.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/TypeCollaboratorIndictment.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.core.builder.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * These indictments are issued when there is a T1 change to a - * type, including change of visibility, change of gender, abstractness, etc. - */ class TypeCollaboratorIndictment extends Indictment { /** * Creates a new TypeCollaboratorIndictment. @@ -28,6 +19,6 @@ */ public String toString() { // don't use + with char[] - return new StringBuffer("TypeIndictment("/*nonNLS*/).append(fName).append(")"/*nonNLS*/).toString(); + return new StringBuffer("TypeIndictment(").append(fName).append(")").toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/TypeHierarchyIndictment.java b/model/org/eclipse/jdt/internal/core/builder/impl/TypeHierarchyIndictment.java index cf0bf75..af02333 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/TypeHierarchyIndictment.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/TypeHierarchyIndictment.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.core.builder.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * Type hierarchy indictments are issued whenever there is any - * change to the supertype hierarchy graph for a given type. - */ public class TypeHierarchyIndictment extends Indictment { /** * Creates a new TypeHierarchyIndictment. @@ -28,6 +19,6 @@ */ public String toString() { // don't use + with char[] - return new StringBuffer("TypeHierarchyIndictment("/*nonNLS*/).append(fName).append(")"/*nonNLS*/).toString(); + return new StringBuffer("TypeHierarchyIndictment(").append(fName).append(")").toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/TypeImpl.java b/model/org/eclipse/jdt/internal/core/builder/impl/TypeImpl.java index a7b9c0d..ffd1b9b 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/TypeImpl.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/TypeImpl.java
@@ -16,7 +16,7 @@ typeA = (IType)a; typeB = (IType)b; } catch (ClassCastException e) { - Assert.isTrue(false, "Should only be comparing ITypes"/*nonNLS*/); + Assert.isTrue(false, "Should only be comparing ITypes"); } return typeA.getName().compareTo(typeB.getName()); } @@ -149,7 +149,7 @@ * a String of length 0. */ public String getDeclaredName() throws NotPresentException { - return ""/*nonNLS*/; + return ""; } /** * If the class or interface represented by this Type object is @@ -476,6 +476,6 @@ * only (NON-NLS). */ public String toString() { - return "type "/*nonNLS*/ + getName(); + return "type " + getName(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/TypeImplSWH.java b/model/org/eclipse/jdt/internal/core/builder/impl/TypeImplSWH.java index 373d854..7c14bad 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/TypeImplSWH.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/TypeImplSWH.java
@@ -126,7 +126,7 @@ * a String of length 0. */ public String getDeclaredName() throws NotPresentException { - return ""/*nonNLS*/; + return ""; } /** * If the class or interface represented by this Type object is
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/TypeNode.java b/model/org/eclipse/jdt/internal/core/builder/impl/TypeNode.java index bd9a84b..3ae8509 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/TypeNode.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/TypeNode.java
@@ -63,6 +63,6 @@ * purposes only. */ public String toString() { - return "TypeNode("/*nonNLS*/ + fType.getFileName() + ")"/*nonNLS*/; + return "TypeNode(" + fType.getFileName() + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/TypeStructureEntry.java b/model/org/eclipse/jdt/internal/core/builder/impl/TypeStructureEntry.java index 3e11a4f..dd67c9d 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/TypeStructureEntry.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/TypeStructureEntry.java
@@ -92,11 +92,11 @@ * @return a string representation of the receiver */ public String toString() { - StringBuffer buf = new StringBuffer("TypeStructureEntry("/*nonNLS*/); + StringBuffer buf = new StringBuffer("TypeStructureEntry("); if (fType != null) { buf.append(fType.getName()); } - buf.append(")"/*nonNLS*/); + buf.append(")"); return buf.toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/UnmodifiedBuilderType.java b/model/org/eclipse/jdt/internal/core/builder/impl/UnmodifiedBuilderType.java index 21812de..fe514db 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/UnmodifiedBuilderType.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/UnmodifiedBuilderType.java
@@ -52,6 +52,6 @@ * For debugging only */ public String toString() { - return "UnmodifiedBuilderType("/*nonNLS*/ + fNewTSEntry.getType().getName() + ")"/*nonNLS*/; + return "UnmodifiedBuilderType(" + fNewTSEntry.getType().getName() + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/WorkQueue.java b/model/org/eclipse/jdt/internal/core/builder/impl/WorkQueue.java index 8f263a0..0d05f59 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/WorkQueue.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/WorkQueue.java
@@ -61,7 +61,7 @@ } else { if (entry.status != NEEDS_COMPILE) { if (entry.status == COMPILED) { - System.out.println("Warning: image builder wants to recompile already compiled element: "/*nonNLS*/ + element); + System.out.println("Warning: image builder wants to recompile already compiled element: " + element); } entry.status = NEEDS_COMPILE; needsCompileList.addElement(element); @@ -79,7 +79,7 @@ entries.put(element, entry); } else { if (entry.status != NEEDS_COMPILE) { - System.out.println("Warning: Java builder compiled the same element twice: "/*nonNLS*/ + element); + System.out.println("Warning: Java builder compiled the same element twice: " + element); } needsCompileList.removeElement(element); } @@ -117,6 +117,6 @@ return entry != null && entry.status == NEEDS_COMPILE; } public String toString() { - return "WorkQueue: "/*nonNLS*/ + needsCompileList; + return "WorkQueue: " + needsCompileList; } }
diff --git a/model/org/eclipse/jdt/internal/core/builder/impl/ZipNode.java b/model/org/eclipse/jdt/internal/core/builder/impl/ZipNode.java index 2f51cb3..3149537 100644 --- a/model/org/eclipse/jdt/internal/core/builder/impl/ZipNode.java +++ b/model/org/eclipse/jdt/internal/core/builder/impl/ZipNode.java
@@ -5,7 +5,6 @@ * All Rights Reserved. */ import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.internal.core.builder.IType; /** * A node in the dependency graph representing a jar or zip file. All @@ -24,10 +23,6 @@ protected ZipNode(IPath zipPath) { fZipFile = zipPath; } - -public IType[] getTypes(){ - return null; -} /** * Creates and returns a copy of this node. */ @@ -57,6 +52,6 @@ * purposes only. */ public String toString() { - return "ZipNode("/*nonNLS*/ + fZipFile + ")"/*nonNLS*/; + return "ZipNode(" + fZipFile + ")"; } }
diff --git a/model/org/eclipse/jdt/internal/core/eval/EvaluationContextWrapper.java b/model/org/eclipse/jdt/internal/core/eval/EvaluationContextWrapper.java index 2e7995f..005df90 100644 --- a/model/org/eclipse/jdt/internal/core/eval/EvaluationContextWrapper.java +++ b/model/org/eclipse/jdt/internal/core/eval/EvaluationContextWrapper.java
@@ -52,7 +52,7 @@ */ protected void checkBuilderState() throws JavaModelException { if (!getProject().hasBuildState()) { - throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.EVALUATION_ERROR, Util.bind("eval.needBuiltState"/*nonNLS*/))); + throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.EVALUATION_ERROR, "Cannot evaluate if the project has not been built once")); } } /** @@ -75,7 +75,7 @@ this.context.select( codeSnippet.toCharArray(), offset, - offset + length - 1, + offset + length, this.project.getSearchableNameEnvironment(), requestor, JavaModelManager.convertConfigurableOptions(JavaCore.getOptions()) @@ -90,7 +90,7 @@ GlobalVariableWrapper wrapper = (GlobalVariableWrapper)variable; this.context.deleteVariable(wrapper.variable); } else { - throw new Error("Unknown implementation of IGlobalVariable"/*nonNLS*/); + throw new Error("Unknown implementation of IGlobalVariable"); } } /**
diff --git a/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java b/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java index 3e82004..4ca34f8 100644 --- a/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java +++ b/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java
@@ -162,37 +162,30 @@ public String toString() { StringBuffer buffer = new StringBuffer(); if (this.modifiers == IConstants.AccPublic) { - buffer.append("public "/*nonNLS*/); + buffer.append("public "); } if (this.isClass()) { - buffer.append("class "/*nonNLS*/); + buffer.append("class "); } else { - buffer.append("interface "/*nonNLS*/); + buffer.append("interface "); } if (this.name != null) { buffer.append(this.name); } if (this.superclass != null) { - buffer.append("\n extends "/*nonNLS*/); + buffer.append("\n extends "); buffer.append(this.superclass); } int length; if (this.superInterfaces != null && (length = this.superInterfaces.length) != 0) { - buffer.append("\n implements "/*nonNLS*/); + buffer.append("\n implements "); for (int i = 0; i < length; i++) { buffer.append(this.superInterfaces[i]); if (i != length - 1) { - buffer.append(", "/*nonNLS*/); + buffer.append(", "); } } } return buffer.toString(); } - -/** - * @see org.eclipse.jdt.internal.compiler.env.IBinaryType. - */ -public char[] sourceFileName() { - return null; -} }
diff --git a/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java b/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java index 1b204e5..0fda2a8 100644 --- a/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java +++ b/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java
@@ -24,7 +24,6 @@ import org.eclipse.jdt.internal.compiler.env.IGenericType; import org.eclipse.jdt.internal.core.search.indexing.AbstractIndexer; import org.eclipse.jdt.internal.core.*; -import org.eclipse.jdt.internal.core.Util; import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; @@ -75,7 +74,7 @@ return name; } public String toString(){ - StringBuffer buffer = new StringBuffer("Queue:\n"/*nonNLS*/); + StringBuffer buffer = new StringBuffer("Queue:\n"); for (int i = this.start; i <= this.end; i++){ buffer.append(names[i]).append('\n'); } @@ -269,16 +268,7 @@ this.buildForProject((JavaProject)currentProject, infos, units); } catch (JavaModelException e) { } - - // Compute hierarchy of focus type if not already done (case of a type with potential subtypes that are not real subtypes) - if (!this.hierarchy.contains(focusType)) { - try { - currentProject = focusType.getJavaProject(); - this.buildForProject((JavaProject)currentProject, new Vector(), new Vector()); - } catch (JavaModelException e) { - } - } - + // Add focus if not already in (case of a type with no explicit super type) if (!this.hierarchy.contains(focusType)) { this.hierarchy.addRootClass(focusType); @@ -319,7 +309,7 @@ */ private void createInfoFromClassFileInJar(Openable classFile, Vector infos) throws JavaModelException { IJavaElement pkg = classFile.getParent(); - String classFilePath = pkg.getElementName().replace('.', '/') + "/"/*nonNLS*/ + classFile.getElementName(); + String classFilePath = pkg.getElementName().replace('.', '/') + "/" + classFile.getElementName(); IGenericType info = null; java.util.zip.ZipFile zipFile = null; try { @@ -443,7 +433,7 @@ IIndexSearchRequestor searchRequestor = new IndexSearchAdapter(){ public void acceptSuperTypeReference(String resourcePath, char[] qualification, char[] typeName, char[] enclosingTypeName, char classOrInterface, char[] superQualification, char[] superTypeName, char superClassOrInterface, int modifiers) { pathRequestor.acceptPath(resourcePath); - if (resourcePath.endsWith("class"/*nonNLS*/)){ + if (resourcePath.endsWith("class")){ HierarchyBinaryType binaryType = (HierarchyBinaryType)binariesFromIndexMatches.get(resourcePath); if (binaryType == null){ binaryType = new HierarchyBinaryType(modifiers, qualification, typeName, enclosingTypeName, classOrInterface);
diff --git a/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java b/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java index de684ca..8fa6da8 100644 --- a/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java +++ b/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java
@@ -22,7 +22,6 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.search.*; import org.eclipse.jdt.internal.core.*; -import org.eclipse.jdt.internal.core.Util; import org.eclipse.jdt.internal.core.search.*; import java.util.*; @@ -1022,7 +1021,7 @@ } fProgressMonitor = monitor; if (monitor != null) { - monitor.beginTask(Util.bind("hierarchy.creating"/*nonNLS*/), IProgressMonitor.UNKNOWN); + monitor.beginTask("Creating type hierarchy...", IProgressMonitor.UNKNOWN); } compute(); if (fType != null) { @@ -1097,7 +1096,7 @@ return false; } if (superclassName == null) { - superclassName = "Object"/*nonNLS*/; + superclassName = "Object"; } int dot = -1; String simpleSuper = (dot = superclassName.lastIndexOf('.')) > -1 ? @@ -1133,24 +1132,24 @@ */ public String toString() { StringBuffer buffer = new StringBuffer(); - buffer.append("Focus: "/*nonNLS*/); - buffer.append(fType == null ? "<NONE>"/*nonNLS*/ : fType.getFullyQualifiedName()); - buffer.append("\n"/*nonNLS*/); + buffer.append("Focus: "); + buffer.append(fType == null ? "<NONE>" : fType.getFullyQualifiedName()); + buffer.append("\n"); if (exists()) { if (fType != null) { - buffer.append("Super types:\n"/*nonNLS*/); + buffer.append("Super types:\n"); toString(buffer, fType, 1, true); - buffer.append("Sub types:\n"/*nonNLS*/); + buffer.append("Sub types:\n"); toString(buffer, fType, 1, false); } else { - buffer.append("Sub types of root classes:\n"/*nonNLS*/); + buffer.append("Sub types of root classes:\n"); IType[] roots= getRootClasses(); for (int i= 0; i < roots.length; i++) { toString(buffer, roots[i], 1, false); } } } else { - buffer.append("(Hierarchy became stale)"/*nonNLS*/); + buffer.append("(Hierarchy became stale)"); } return buffer.toString(); } @@ -1161,7 +1160,7 @@ */ private void toString(StringBuffer buffer, IType type, int indent, boolean ascendant) { for (int i= 0; i < indent; i++) { - buffer.append(" "/*nonNLS*/); + buffer.append(" "); } buffer.append(type.getFullyQualifiedName()); buffer.append('\n');
diff --git a/model/org/eclipse/jdt/internal/core/jdom/CompilationUnit.java b/model/org/eclipse/jdt/internal/core/jdom/CompilationUnit.java index b7454d9..4583cd9 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/CompilationUnit.java +++ b/model/org/eclipse/jdt/internal/core/jdom/CompilationUnit.java
@@ -22,11 +22,11 @@ fFileName = filename; String file = new String(filename); - int start = file.lastIndexOf("/"/*nonNLS*/) + 1; - if (start == 0 || start < file.lastIndexOf("\\"/*nonNLS*/)) - start = file.lastIndexOf("\\"/*nonNLS*/) + 1; + int start = file.lastIndexOf("/") + 1; + if (start == 0 || start < file.lastIndexOf("\\")) + start = file.lastIndexOf("\\") + 1; - int end = file.lastIndexOf("."/*nonNLS*/); + int end = file.lastIndexOf("."); if (end == -1) end = file.length(); @@ -42,6 +42,6 @@ return fMainTypeName; } public String toString() { - return "CompilationUnit["/*nonNLS*/ + new String(fFileName) + "]"/*nonNLS*/; + return "CompilationUnit[" + new String(fFileName) + "]"; } }
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMCompilationUnit.java b/model/org/eclipse/jdt/internal/core/jdom/DOMCompilationUnit.java index 421510e..b78a0df 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/DOMCompilationUnit.java +++ b/model/org/eclipse/jdt/internal/core/jdom/DOMCompilationUnit.java
@@ -10,7 +10,6 @@ import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.jdom.*; -import org.eclipse.jdt.internal.core.Util; import org.eclipse.jdt.internal.core.util.*; import java.util.Vector; @@ -33,7 +32,7 @@ * Creates a new empty COMPILATION_UNIT document fragment. */ DOMCompilationUnit() { - fHeader=""/*nonNLS*/; + fHeader=""; } /** * Creates a new COMPILATION_UNIT on the given range of the document. @@ -47,7 +46,7 @@ */ DOMCompilationUnit(char[] document, int[] sourceRange) { super(document, sourceRange, null, new int[]{-1, -1}); - fHeader = ""/*nonNLS*/; + fHeader = ""; } /** * @see DOMNode#appendContents(CharArrayBuffer) @@ -75,7 +74,7 @@ if (parent.getElementType() == IJavaElement.PACKAGE_FRAGMENT) { return ((IPackageFragment)parent).getCompilationUnit(getName()); } else { - throw new IllegalArgumentException(Util.bind("element.illegalParent"/*nonNLS*/)); + throw new IllegalArgumentException("Illegal parent argument"); } } /** @@ -102,7 +101,7 @@ topLevelType= firstType; } if (topLevelType != null) { - return topLevelType.getName() + ".java"/*nonNLS*/; + return topLevelType.getName() + ".java"; } else { return null; } @@ -174,6 +173,6 @@ * @see IDOMNode#toString() */ public String toString() { - return "COMPILATION_UNIT: "/*nonNLS*/ + getName(); + return "COMPILATION_UNIT: " + getName(); } }
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMField.java b/model/org/eclipse/jdt/internal/core/jdom/DOMField.java index e9d22f5..07554b0 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/DOMField.java +++ b/model/org/eclipse/jdt/internal/core/jdom/DOMField.java
@@ -4,17 +4,17 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import java.util.Enumeration; +import org.eclipse.core.resources.*; +import org.eclipse.jdt.core.Flags; import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.jdom.DOMException; -import org.eclipse.jdt.core.jdom.IDOMField; -import org.eclipse.jdt.core.jdom.IDOMNode; +import org.eclipse.jdt.core.jdom.*; import org.eclipse.jdt.internal.core.JavaModelManager; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.util.CharArrayBuffer; -import org.eclipse.jdt.internal.core.util.CharArrayOps; +import org.eclipse.jdt.internal.core.util.*; + +import java.util.Enumeration; /** * DOMField provides an implementation of IDOMField. @@ -163,7 +163,7 @@ if (hasInitializer()) { if (fInitializerRange[0] < 0) { buffer - .append('=') + .append("=") .append(fInitializer) .append(fDocument, fNameRange[1] + 1, fSourceRange[1] - fNameRange[1]); } else { @@ -229,7 +229,7 @@ DOMBuilder builder = new DOMBuilder(); IDOMField[] details= builder.createFields(source.toCharArray()); if (details.length == 0) { - throw new DOMException(Util.bind("dom.cannotDetail"/*nonNLS*/)); + throw new DOMException("Unable to generate detailed source indexes."); } else { node= this; for (int i= 0; i < details.length; i++) { @@ -316,7 +316,7 @@ if (parent.getElementType() == IJavaElement.TYPE) { return ((IType)parent).getField(getName()); } else { - throw new IllegalArgumentException(Util.bind("element.illegalParent"/*nonNLS*/)); + throw new IllegalArgumentException("Illegal parent argument"); } } /** @@ -358,7 +358,7 @@ first.appendMemberHeaderFragment(buffer); buffer.append(getType()); if (isVariableDeclarator()) { - buffer.append(' '); + buffer.append(" "); } else { buffer.append(fDocument, fTypeRange[1] + 1, fNameRange[0] - fTypeRange[1] - 1); } @@ -370,7 +370,7 @@ if (hasInitializer()) { if (fInitializerRange[0] < 0) { buffer - .append('=') + .append("=") .append(fInitializer) .append(';') .append(JavaModelManager.LINE_SEPARATOR); @@ -561,7 +561,7 @@ */ public void setName(String name) throws IllegalArgumentException { if (name == null) { - throw new IllegalArgumentException(Util.bind("element.nullName"/*nonNLS*/)); + throw new IllegalArgumentException("illegal to set name to null"); } else { super.setName(name); setTypeAltered(true); @@ -572,7 +572,7 @@ */ public void setType(String typeName) throws IllegalArgumentException { if (typeName == null) { - throw new IllegalArgumentException(Util.bind("element.nullType"/*nonNLS*/)); + throw new IllegalArgumentException("Illegal to set field type to null"); } becomeDetailed(); expand(); @@ -603,6 +603,6 @@ * @see IDOMNode#toString() */ public String toString() { - return "FIELD: "/*nonNLS*/ + getName(); + return "FIELD: " + getName(); } }
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java b/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java index 5a9baf6..759a59e 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java +++ b/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java
@@ -4,13 +4,15 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ +import org.eclipse.core.resources.*; + +import org.eclipse.jdt.core.Flags; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.jdom.IDOMImport; -import org.eclipse.jdt.core.jdom.IDOMNode; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.jdom.*; import org.eclipse.jdt.internal.core.JavaModelManager; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.util.CharArrayBuffer; +import org.eclipse.jdt.internal.core.util.*; /** * DOMImport provides an implementation of IDOMImport. @@ -27,7 +29,7 @@ * Creates a new empty IMPORT node. */ DOMImport() { - fName = "java.lang.*"/*nonNLS*/; + fName = "java.lang.*"; setMask(MASK_DETAILED_SOURCE_INDEXES, true); } /** @@ -78,7 +80,7 @@ protected void appendFragmentedContents(CharArrayBuffer buffer) { if (fNameRange[0] < 0) { buffer - .append("import "/*nonNLS*/) + .append("import ") .append(fName) .append(';') .append(JavaModelManager.LINE_SEPARATOR); @@ -112,7 +114,7 @@ if (parent.getElementType() == IJavaElement.COMPILATION_UNIT) { return ((ICompilationUnit)parent).getImport(getName()); } else { - throw new IllegalArgumentException(Util.bind("element.illegalParent"/*nonNLS*/)); + throw new IllegalArgumentException("Illegal parent argument"); } } /** @@ -138,16 +140,16 @@ */ public void setName(String name) { if (name == null) { - throw new IllegalArgumentException(Util.bind("element.nullName"/*nonNLS*/)); + throw new IllegalArgumentException("illegal to set name to null"); } becomeDetailed(); super.setName(name); - fOnDemand = name.endsWith(".*"/*nonNLS*/); + fOnDemand = name.endsWith(".*"); } /** * @see IDOMNode#toString() */ public String toString() { - return "IMPORT: "/*nonNLS*/ + getName(); + return "IMPORT: " + getName(); } }
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMInitializer.java b/model/org/eclipse/jdt/internal/core/jdom/DOMInitializer.java index 0a1e6a2..55164d9 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/DOMInitializer.java +++ b/model/org/eclipse/jdt/internal/core/jdom/DOMInitializer.java
@@ -4,14 +4,16 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ +import org.eclipse.core.resources.*; + +import org.eclipse.jdt.core.Flags; import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.jdom.IDOMInitializer; -import org.eclipse.jdt.core.jdom.IDOMNode; +import org.eclipse.jdt.core.jdom.*; import org.eclipse.jdt.internal.core.JavaModelManager; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.util.CharArrayBuffer; -import org.eclipse.jdt.internal.core.util.CharArrayOps; +import org.eclipse.jdt.internal.core.util.*; +import org.w3c.dom.DOMImplementation; /** * DOMInitializer provides an implementation of IDOMInitializer. @@ -102,7 +104,7 @@ .append(getBody()) .append(fDocument, fBodyRange[1] + 1, fSourceRange[1] - fBodyRange[1]); } else { - buffer.append("{}"/*nonNLS*/).append(JavaModelManager.LINE_SEPARATOR); + buffer.append("{}").append(JavaModelManager.LINE_SEPARATOR); } } /** @@ -156,7 +158,7 @@ } return ((IType) parent).getInitializer(count); } else { - throw new IllegalArgumentException(Util.bind("element.illegalParent"/*nonNLS*/)); + throw new IllegalArgumentException("Illegal parent argument"); } } /** @@ -219,6 +221,6 @@ * @see IDOMNode#toString() */ public String toString() { - return "INITIALIZER"/*nonNLS*/; + return "INITIALIZER"; } }
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMMember.java b/model/org/eclipse/jdt/internal/core/jdom/DOMMember.java index 76e25ee..ebbd1f8 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/DOMMember.java +++ b/model/org/eclipse/jdt/internal/core/jdom/DOMMember.java
@@ -281,7 +281,7 @@ /* see 1FVIJAH */ if (comment != null) { String commentString = new String(comment); - if (commentString.indexOf("@deprecated"/*nonNLS*/) >= 0) { + if (commentString.indexOf("@deprecated") >= 0) { fFlags= fFlags | IConstants.AccDeprecated; return; }
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMMethod.java b/model/org/eclipse/jdt/internal/core/jdom/DOMMethod.java index 921ef4c..58a3665 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/DOMMethod.java +++ b/model/org/eclipse/jdt/internal/core/jdom/DOMMethod.java
@@ -4,15 +4,16 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ +import org.eclipse.core.resources.*; + +import org.eclipse.jdt.core.Flags; import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.Signature; -import org.eclipse.jdt.core.jdom.IDOMMethod; -import org.eclipse.jdt.core.jdom.IDOMNode; +import org.eclipse.jdt.core.jdom.*; import org.eclipse.jdt.internal.core.JavaModelManager; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.util.CharArrayBuffer; -import org.eclipse.jdt.internal.core.util.CharArrayOps; +import org.eclipse.jdt.internal.core.util.*; /** * DOMMethod provides an implementation of IDOMMethod. @@ -226,7 +227,7 @@ */ public void addException(String name) throws IllegalArgumentException { if (name == null) { - throw new IllegalArgumentException(Util.bind("dom.nullExceptionType"/*nonNLS*/)); + throw new IllegalArgumentException("Cannot add null exception"); } if (fExceptions == null) { fExceptions= new String[1]; @@ -241,10 +242,10 @@ */ public void addParameter(String type, String name) throws IllegalArgumentException { if (type == null) { - throw new IllegalArgumentException(Util.bind("dom.nullTypeParameter"/*nonNLS*/)); + throw new IllegalArgumentException("Cannot add parameter with null type"); } if (name == null) { - throw new IllegalArgumentException(Util.bind("dom.nullNameParameter"/*nonNLS*/)); + throw new IllegalArgumentException("Cannot add parameter with null name"); } if (fParameterNames == null) { fParameterNames= new String[1]; @@ -284,7 +285,7 @@ if (fReturnTypeRange[0] >= 0) { buffer.append(fDocument, fReturnTypeRange[1] + 1, fNameRange[0] - fReturnTypeRange[1] - 1); } else { - buffer.append(' '); + buffer.append(" "); } buffer .append(getNameContents()) @@ -306,7 +307,7 @@ if (fExceptionRange[0] >= 0) { buffer.append(fDocument, start, fExceptionRange[0] - start); } else { - buffer.append(" throws "/*nonNLS*/); + buffer.append(" throws "); } // add exception list if (fExceptionList != null) { @@ -414,7 +415,7 @@ } return ((IType)parent).getMethod(name, sigs); } else { - throw new IllegalArgumentException(Util.bind("element.illegalParent"/*nonNLS*/)); + throw new IllegalArgumentException("Illegal parent argument"); } } /** @@ -573,7 +574,7 @@ fBody= body; setHasBody(body != null); if (!hasBody()) { - fBody= ";"/*nonNLS*/+JavaModelManager.LINE_SEPARATOR; + fBody= ";"+JavaModelManager.LINE_SEPARATOR; } } /** @@ -615,7 +616,7 @@ */ public void setName(String name) { if (name == null) { - throw new IllegalArgumentException(Util.bind("element.nullName"/*nonNLS*/)); + throw new IllegalArgumentException("illegal to set method name to null"); } else { super.setName(name); } @@ -631,17 +632,17 @@ fParameterNames= null; fParameterList= new char[] {'(',')'}; } else { - throw new IllegalArgumentException(Util.bind("dom.mismatchArgNamesAndTypes"/*nonNLS*/)); + throw new IllegalArgumentException("types and names must have identical length"); } } else if (names.length != types.length) { - throw new IllegalArgumentException(Util.bind("dom.mismatchArgNamesAndTypes"/*nonNLS*/)); + throw new IllegalArgumentException("types and names must have identical length"); } else if (names.length == 0) { setParameters(null, null); } else { fParameterNames= names; fParameterTypes= types; CharArrayBuffer parametersBuffer = new CharArrayBuffer(); - parametersBuffer.append("("/*nonNLS*/); + parametersBuffer.append("("); char[] comma = new char[] {',', ' '}; for (int i = 0; i < names.length; i++) { if (i > 0) { @@ -649,10 +650,10 @@ } parametersBuffer .append(types[i]) - .append(' ') + .append(" ") .append(names[i]); } - parametersBuffer.append(')'); + parametersBuffer.append(")"); fParameterList= parametersBuffer.getContents(); } fragment(); @@ -662,7 +663,7 @@ */ public void setReturnType(String name) throws IllegalArgumentException { if (name == null) { - throw new IllegalArgumentException(Util.bind("dom.nullReturnType"/*nonNLS*/)); + throw new IllegalArgumentException("illegal return type of null"); } becomeDetailed(); fragment(); @@ -705,9 +706,9 @@ */ public String toString() { if (isConstructor()) { - return "CONSTRUCTOR"/*nonNLS*/; + return "CONSTRUCTOR"; } else { - return "METHOD: "/*nonNLS*/ + getName(); + return "METHOD: " + getName(); } } }
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMNode.java b/model/org/eclipse/jdt/internal/core/jdom/DOMNode.java index 660f13c..d3a1181 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/DOMNode.java +++ b/model/org/eclipse/jdt/internal/core/jdom/DOMNode.java
@@ -4,16 +4,11 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import java.util.Enumeration; +import org.eclipse.jdt.core.jdom.*; +import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.internal.core.util.*; -import org.eclipse.jdt.core.jdom.DOMException; -import org.eclipse.jdt.core.jdom.DOMFactory; -import org.eclipse.jdt.core.jdom.IDOMCompilationUnit; -import org.eclipse.jdt.core.jdom.IDOMFactory; -import org.eclipse.jdt.core.jdom.IDOMMethod; -import org.eclipse.jdt.core.jdom.IDOMNode; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.util.CharArrayBuffer; +import java.util.*; /** * DOMNode provides an implementation for <code>IDOMNode</code>. @@ -331,23 +326,23 @@ void basicAddChild(IDOMNode child) throws IllegalArgumentException, DOMException { // verify child may be added if (!canHaveChildren()) { - throw new DOMException(Util.bind("dom.unableAddChild"/*nonNLS*/)); + throw new DOMException("attempt to add child to node that cannot have children"); } if (child == null) { - throw new IllegalArgumentException(Util.bind("dom.addNullChild"/*nonNLS*/)); + throw new IllegalArgumentException("attempt to add null child"); } if (!isAllowableChild(child)) { - throw new DOMException(Util.bind("dom.addIncompatibleChild"/*nonNLS*/)); + throw new DOMException("attempt to add child of incompatible type"); } if (child.getParent() != null) { - throw new DOMException(Util.bind("dom.addChildWithParent"/*nonNLS*/)); + throw new DOMException("attempt to add child that is already parented"); } /* NOTE: To test if the child is an ancestor of this node, we * need only test if the root of this node is the child (the child * is already a root since we have just guarenteed it has no parent). */ if (child == getRoot()) { - throw new DOMException(Util.bind("dom.addAncestorAsChild"/*nonNLS*/)); + throw new DOMException("attempt to add ancestor as child"); } DOMNode node= (DOMNode)child; @@ -379,7 +374,7 @@ if (!isDetailed()) { DOMNode detailed= getDetailedNode(); if (detailed == null) { - throw new DOMException(Util.bind("dom.cannotDetail"/*nonNLS*/)); + throw new DOMException("Unable to generate detailed source indexes."); } if (detailed != this) { shareContents(detailed); @@ -652,23 +647,23 @@ public void insertSibling(IDOMNode sibling) throws IllegalArgumentException, DOMException { // verify sibling may be added if (sibling == null) { - throw new IllegalArgumentException(Util.bind("dom.addNullSibling"/*nonNLS*/)); + throw new IllegalArgumentException("attempt to insert null sibling"); } if (fParent == null) { - throw new DOMException(Util.bind("dom.addSiblingBeforeRoot"/*nonNLS*/)); + throw new DOMException("attempt to insert sibling before root node"); } if (!fParent.isAllowableChild(sibling)) { - throw new DOMException(Util.bind("dom.addIncompatibleSibling"/*nonNLS*/)); + throw new DOMException("attempt to insert sibling of incompatible type"); } if (sibling.getParent() != null) { - throw new DOMException(Util.bind("dom.addSiblingWithParent"/*nonNLS*/)); + throw new DOMException("attempt to insert sibling that is already parented"); } /* NOTE: To test if the sibling is an ancestor of this node, we * need only test if the root of this node is the child (the sibling * is already a root since we have just guaranteed it has no parent). */ if (sibling == getRoot()) { - throw new DOMException(Util.bind("dom.addAncestorAsSibling"/*nonNLS*/)); + throw new DOMException("attempt to insert ancestor as sibling"); } DOMNode node= (DOMNode)sibling;
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMPackage.java b/model/org/eclipse/jdt/internal/core/jdom/DOMPackage.java index dec2d57..ca015de 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/DOMPackage.java +++ b/model/org/eclipse/jdt/internal/core/jdom/DOMPackage.java
@@ -4,13 +4,15 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ +import org.eclipse.core.resources.*; + import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.jdom.IDOMNode; -import org.eclipse.jdt.core.jdom.IDOMPackage; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.Flags; +import org.eclipse.jdt.core.jdom.*; import org.eclipse.jdt.internal.core.JavaModelManager; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.util.CharArrayBuffer; +import org.eclipse.jdt.internal.core.util.*; /** * DOMPackage provides an implementation of IDOMPackage. @@ -70,7 +72,7 @@ protected void appendFragmentedContents(CharArrayBuffer buffer) { if (fNameRange[0] < 0) { buffer - .append("package "/*nonNLS*/) + .append("package ") .append(fName) .append(';') .append(JavaModelManager.LINE_SEPARATOR); @@ -104,7 +106,7 @@ if (parent.getElementType() == IJavaElement.COMPILATION_UNIT) { return ((ICompilationUnit)parent).getPackageDeclaration(getName()); } else { - throw new IllegalArgumentException(Util.bind("element.illegalParent"/*nonNLS*/)); + throw new IllegalArgumentException("Illegal parent argument"); } } /** @@ -130,6 +132,6 @@ * @see IDOMNode#toString() */ public String toString() { - return "PACKAGE: "/*nonNLS*/ + getName(); + return "PACKAGE: " + getName(); } }
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMType.java b/model/org/eclipse/jdt/internal/core/jdom/DOMType.java index f113224..f4631c7 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/DOMType.java +++ b/model/org/eclipse/jdt/internal/core/jdom/DOMType.java
@@ -4,20 +4,19 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import java.util.Enumeration; +import org.eclipse.core.resources.*; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.jdom.IDOMMethod; -import org.eclipse.jdt.core.jdom.IDOMNode; -import org.eclipse.jdt.core.jdom.IDOMType; +import org.eclipse.jdt.core.jdom.*; +import org.eclipse.jdt.internal.core.util.*; import org.eclipse.jdt.internal.compiler.parser.InvalidInputException; import org.eclipse.jdt.internal.compiler.parser.Scanner; import org.eclipse.jdt.internal.compiler.parser.TerminalSymbols; -import org.eclipse.jdt.internal.core.Util; -import org.eclipse.jdt.internal.core.util.CharArrayBuffer; -import org.eclipse.jdt.internal.core.util.CharArrayOps; + +import java.util.Enumeration; /** * DOMType provides an implementation of IDOMType. @@ -226,7 +225,7 @@ */ public void addSuperInterface(String name) throws IllegalArgumentException { if (name == null) { - throw new IllegalArgumentException(Util.bind("dom.addNullInterface"/*nonNLS*/)); + throw new IllegalArgumentException("Cannot add null interface"); } if (fSuperInterfaces == null) { fSuperInterfaces= new String[1]; @@ -264,7 +263,7 @@ if (getMask(MASK_TYPE_HAS_SUPERCLASS)) { hasSuperclass = true; if (fExtendsRange[0] < 0) { - buffer.append(" extends "/*nonNLS*/); + buffer.append(" extends "); } else { buffer.append(fDocument, fExtendsRange[0], fExtendsRange[1] + 1 - fExtendsRange[0]); } @@ -277,7 +276,7 @@ if (getMask(MASK_TYPE_HAS_INTERFACES)) { hasInterfaces = true; if (fImplementsRange[0] < 0) { - buffer.append(" implements "/*nonNLS*/); + buffer.append(" implements "); } else { buffer.append(fDocument, fImplementsRange[0], fImplementsRange[1] + 1 - fImplementsRange[0]); } @@ -289,14 +288,14 @@ } if (hasInterfaces) { if (fImplementsRange[0] < 0) { - buffer.append(' '); + buffer.append(" "); } else { buffer.append(fDocument, fInterfacesRange[1] + 1, fOpenBodyRange[0] - fInterfacesRange[1] - 1); } } else { if (hasSuperclass) { if (fSuperclassRange[0] < 0) { - buffer.append(' '); + buffer.append(" "); } else { buffer.append(fDocument, fSuperclassRange[1] + 1, fOpenBodyRange[0] - fSuperclassRange[1] - 1); } @@ -307,13 +306,13 @@ } else { if (getMask(MASK_TYPE_HAS_INTERFACES)) { if (fExtendsRange[0] < 0) { - buffer.append(" extends "/*nonNLS*/); + buffer.append(" extends "); } else { buffer.append(fDocument, fExtendsRange[0], fExtendsRange[1] + 1 - fExtendsRange[0]); } if (fInterfaces != null) { buffer.append(fInterfaces); - buffer.append(' '); + buffer.append(" "); } else { buffer.append(fDocument, fInterfacesRange[0], fInterfacesRange[1] + 1 - fInterfacesRange[0]); } @@ -377,7 +376,7 @@ } else if (parent.getElementType() == IJavaElement.COMPILATION_UNIT) { return ((ICompilationUnit)parent).getType(getName()); } else { - throw new IllegalArgumentException(Util.bind("element.illegalParent"/*nonNLS*/)); + throw new IllegalArgumentException("Illegal parent argument"); } } /** @@ -527,9 +526,9 @@ fragment(); setMask(MASK_TYPE_IS_CLASS, b); if (b) { - fTypeKeyword= "class"/*nonNLS*/; + fTypeKeyword= "class"; } else { - fTypeKeyword= "interface"/*nonNLS*/; + fTypeKeyword= "interface"; setSuperclass(null); } } @@ -556,7 +555,7 @@ */ public void setName(String name) throws IllegalArgumentException { if (name == null) { - throw new IllegalArgumentException(Util.bind("element.nullName"/*nonNLS*/)); + throw new IllegalArgumentException("illegal to set type name to null"); } super.setName(name); Enumeration children= getChildren(); @@ -588,7 +587,7 @@ public void setSuperInterfaces(String[] names) { becomeDetailed(); if (names == null) { - throw new IllegalArgumentException(Util.bind("dom.nullInterfaces"/*nonNLS*/)); + throw new IllegalArgumentException("illegal to set super interfaces to null"); } fragment(); fSuperInterfaces= names; @@ -601,7 +600,7 @@ CharArrayBuffer buffer = new CharArrayBuffer(); for (int i = 0; i < names.length; i++) { if (i > 0) { - buffer.append(", "/*nonNLS*/); + buffer.append(", "); } buffer.append(names[i]); } @@ -636,6 +635,6 @@ * @see IDOMNode#toString() */ public String toString() { - return "TYPE: "/*nonNLS*/ + getName(); + return "TYPE: " + getName(); } }
diff --git a/model/org/eclipse/jdt/internal/core/jdom/ILineStartFinder.java b/model/org/eclipse/jdt/internal/core/jdom/ILineStartFinder.java index e3b2d87..0c8ee08 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/ILineStartFinder.java +++ b/model/org/eclipse/jdt/internal/core/jdom/ILineStartFinder.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.core.jdom; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The <coe>ILineSeparatorFinder</code> finds previous and next line separators - * in source. - */ interface ILineStartFinder { /** * Returns the position of the start of the line at or before the given source position.
diff --git a/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java b/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java index 49830eb..643fe9f 100644 --- a/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java +++ b/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java
@@ -18,6 +18,12 @@ * A DOM builder that uses the SourceElementParser */ public class SimpleDOMBuilder extends AbstractDOMBuilder implements ISourceElementRequestor { + + + + + + /** @@ -27,7 +33,7 @@ String importName = new String(name); /** name is set to contain the '*' */ if (onDemand) { - importName+=".*"/*nonNLS*/; + importName+=".*"; } fNode= new DOMImport(fDocument, sourceRange, importName, onDemand); addChild(fNode);
diff --git a/model/org/eclipse/jdt/internal/core/lookup/ReferenceInfo.java b/model/org/eclipse/jdt/internal/core/lookup/ReferenceInfo.java index 6a73282..dcbbe0e 100644 --- a/model/org/eclipse/jdt/internal/core/lookup/ReferenceInfo.java +++ b/model/org/eclipse/jdt/internal/core/lookup/ReferenceInfo.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.lookup; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public class ReferenceInfo { @@ -28,7 +23,7 @@ public static final byte REFTYPE_type = 0x20; public static final byte REFTYPE_class = 0x40; public static final byte REFTYPE_constant = (byte)0x80; -// public static final byte REFTYPE_label = 256; +// public static final byte REFTYPE_label = 256; /** * Creates a new ReferenceInfo object. There should be one per compilation unit. @@ -53,12 +48,12 @@ * For debugging only */ public String toString() { - StringBuffer buf = new StringBuffer("ReferenceInfo("/*nonNLS*/); + StringBuffer buf = new StringBuffer("ReferenceInfo("); for (int i = 0; i < fNames.length; i++) { buf.append(fNames[i]); - buf.append(" "/*nonNLS*/); + buf.append(" "); } - buf.append(")"/*nonNLS*/); + buf.append(")"); return buf.toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/util/AnonymousFileSource.java b/model/org/eclipse/jdt/internal/core/util/AnonymousFileSource.java index e846e1a..67182ba 100644 --- a/model/org/eclipse/jdt/internal/core/util/AnonymousFileSource.java +++ b/model/org/eclipse/jdt/internal/core/util/AnonymousFileSource.java
@@ -19,7 +19,7 @@ if (!directory.exists()) { directory.mkdirs(); } else if (!directory.isDirectory()) { - throw new IllegalArgumentException("Directory arguments should be a directory."/*nonNLS*/); + throw new IllegalArgumentException("Directory arguments should be a directory."); } fDirectory = directory; } @@ -30,7 +30,7 @@ synchronized public RandomAccessFile allocateAnonymousFile() throws IOException { File file = getAnonymousFile(); - return new RandomAccessFile(file, "rw"/*nonNLS*/); + return new RandomAccessFile(file, "rw"); } /** * Returns a URL on a newly allocated file with the given initial content. @@ -38,17 +38,17 @@ */ synchronized public URL allocateAnonymousURL(byte[] bytes) throws IOException { try { - byte hasharray[] = java.security.MessageDigest.getInstance("SHA"/*nonNLS*/).digest(bytes); + byte hasharray[] = java.security.MessageDigest.getInstance("SHA").digest(bytes); StringBuffer sb = new StringBuffer(); for (int i = 0; i < hasharray.length; i++) { sb.append(Character.forDigit((int)((hasharray[i] >> 4) & 0x0F), 16)); sb.append(Character.forDigit((int)(hasharray[i] & 0x0F), 16)); } - sb.append(".jnk"/*nonNLS*/); + sb.append(".jnk"); String fileName = sb.toString(); File file = fileForName(fileName); if (!file.exists()) { - RandomAccessFile raf = new RandomAccessFile(file, "rw"/*nonNLS*/); + RandomAccessFile raf = new RandomAccessFile(file, "rw"); raf.write(bytes); raf.close(); } @@ -64,7 +64,7 @@ static public URL convertFileToURL(File file) { try { String path = file.getCanonicalPath().replace(java.io.File.separatorChar, '/'); - return new URL("file"/*nonNLS*/, ""/*nonNLS*/, "/"/*nonNLS*/ + path); + return new URL("file", "", "/" + path); } catch (IOException ioe) { throw new Error(); @@ -121,7 +121,7 @@ sb.append(Character.forDigit((int)(l % 36), 36)); l /= 36; } - sb.append(".jnk"/*nonNLS*/); + sb.append(".jnk"); return sb.toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/util/CharArrayBuffer.java b/model/org/eclipse/jdt/internal/core/util/CharArrayBuffer.java index 37fa2e5..00b18b2 100644 --- a/model/org/eclipse/jdt/internal/core/util/CharArrayBuffer.java +++ b/model/org/eclipse/jdt/internal/core/util/CharArrayBuffer.java
@@ -1,26 +1,5 @@ package org.eclipse.jdt.internal.core.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The <code>CharArrayBuffer</code> is intended as a lightweight partial implementation - * of the StringBuffer class, but using <code>char[]'s</code> instead of Strings. - * - * <p>The <code>CharArrayBuffer</code> maintains a list of <code>char[]'s</code> - * which don't get appended until the user asks for them. The following - * code illustrates how to use the class. - * - * <code> - * CharArrayBuffer buffer = new CharArrayBuffer(myCharArray); - * buffer.append(moreBytes, 0, someLength); - * myCharArray = buffer.getContents(); - * </code> - * - * <p>NOTE: This class is not Thread safe! - */ public class CharArrayBuffer { /** * This is the buffer of char arrays which must be appended together
diff --git a/model/org/eclipse/jdt/internal/core/util/CharArrayOps.java b/model/org/eclipse/jdt/internal/core/util/CharArrayOps.java index 66c4306..f8c98a9 100644 --- a/model/org/eclipse/jdt/internal/core/util/CharArrayOps.java +++ b/model/org/eclipse/jdt/internal/core/util/CharArrayOps.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.core.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A class to do characters operations so that we can use - * char arrays more effectively. - */ public class CharArrayOps { /** * Returns the char arrays as an array of Strings @@ -89,9 +80,9 @@ * Extracts a sub-array from the given array, starting * at the given startIndex and proceeding for length characters. * Returns null if: - * 1. the src array is null - * 2. the start index is out of bounds - * 3. the length parameter specifies a end point which is out of bounds + * 1. the src array is null + * 2. the start index is out of bounds + * 3. the length parameter specifies a end point which is out of bounds * Does not return a copy of the array if possible, i.e. if start is zero * and length equals the length of the src array. * @@ -119,9 +110,9 @@ * Extracts a substring from the given array, starting * at the given startIndex and proceeding for length characters. * Returns null if: - * 1. the src array is null - * 2. the start index is out of bounds - * 3. the length parameter specifies a end point which is out of bounds + * 1. the src array is null + * 2. the start index is out of bounds + * 3. the length parameter specifies a end point which is out of bounds * Does not return a copy of the array if possible, i.e. if start is zero * and length equals the length of the src array. *
diff --git a/model/org/eclipse/jdt/internal/core/util/DiskCache.java b/model/org/eclipse/jdt/internal/core/util/DiskCache.java index 7213985..4ad9234 100644 --- a/model/org/eclipse/jdt/internal/core/util/DiskCache.java +++ b/model/org/eclipse/jdt/internal/core/util/DiskCache.java
@@ -4,8 +4,6 @@ * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ -import org.eclipse.jdt.internal.core.Util; - import java.io.*; import java.util.*; @@ -171,9 +169,9 @@ EntryCache fEntryCache; - static final String CONTENTS_FILE_NAME = "contents"/*nonNLS*/; - static final String TEMP_CONTENTS_FILE_NAME = "tempcont"/*nonNLS*/; - static final String CONTENTS_VERSION = "DiskCache.V1.0"/*nonNLS*/; + static final String CONTENTS_FILE_NAME = "contents"; + static final String TEMP_CONTENTS_FILE_NAME = "tempcont"; + static final String CONTENTS_VERSION = "DiskCache.V1.0"; /** * Set to true when cache is modified, cleared when saved. @@ -217,7 +215,7 @@ */ public OutputStream add(final String key, int size, byte[] extraInfo) throws IOException { if (size > fSpaceLimit*1024) { - throw new IOException("Entry size greater than cache size"/*nonNLS*/); + throw new IOException("Entry size greater than cache size"); } final File file; OutputStream output; @@ -518,7 +516,7 @@ int spaceUsed = in.readInt(); /* Ignored -- updated as entries are read */ int numEntries = in.readInt(); if (!sig.equals(CONTENTS_VERSION)) { - throw new IOException(Util.bind("file.badFormat"/*nonNLS*/)); + throw new IOException("Invalid format"); } /* Read to a temp. array of entries. The entries are in most- to @@ -736,7 +734,7 @@ } } }; - fPeriodicSaveThread.setName("DiskCache periodic save"/*nonNLS*/); + fPeriodicSaveThread.setName("DiskCache periodic save"); fPeriodicSaveThread.start(); }
diff --git a/model/org/eclipse/jdt/internal/core/util/DiskCacheEntry.java b/model/org/eclipse/jdt/internal/core/util/DiskCacheEntry.java index 085b429..d5d374f 100644 --- a/model/org/eclipse/jdt/internal/core/util/DiskCacheEntry.java +++ b/model/org/eclipse/jdt/internal/core/util/DiskCacheEntry.java
@@ -1,15 +1,5 @@ package org.eclipse.jdt.internal.core.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A <code>DiskCacheEntry</code> represents the results of looking up an - * entry in a <code>DiskCache</code>. It is part of the DiskCache API and is - * not necessarily used as the internal representation. - */ public class DiskCacheEntry { String fKey; int fSize;
diff --git a/model/org/eclipse/jdt/internal/core/util/Dumper.java b/model/org/eclipse/jdt/internal/core/util/Dumper.java index 2f61613..6d30961 100644 --- a/model/org/eclipse/jdt/internal/core/util/Dumper.java +++ b/model/org/eclipse/jdt/internal/core/util/Dumper.java
@@ -62,30 +62,30 @@ if (!oneLine) { ++fTabLevel; } - fWriter.print("["/*nonNLS*/); + fWriter.print("["); for (int i = 0; i < len; ++i) { if (!oneLine) { if ((i % maxPerLine) == 0) { fWriter.println(); tabIfNeeded(); fWriter.print(i); - fWriter.print(": "/*nonNLS*/); + fWriter.print(": "); } } fWriter.print(val[i]); if (i + 1 < len) { - fWriter.print(", "/*nonNLS*/); + fWriter.print(", "); } } if (oneLine) { - fWriter.print("]"/*nonNLS*/); + fWriter.print("]"); fWriter.println(); } else { fWriter.println(); --fTabLevel; tabIfNeeded(); - fWriter.print("]"/*nonNLS*/); + fWriter.print("]"); fWriter.println(); } } @@ -94,7 +94,7 @@ */ public void dump(Object[] val) { int len = val.length; - fWriter.print("["/*nonNLS*/); + fWriter.print("["); if (len > 0) { fWriter.println(); ++fTabLevel; @@ -104,7 +104,7 @@ --fTabLevel; tabIfNeeded(); } - fWriter.println("]"/*nonNLS*/); + fWriter.println("]"); } /** * Dumps the given array. @@ -116,20 +116,20 @@ if (!oneLine) { ++fTabLevel; } - fWriter.print("["/*nonNLS*/); + fWriter.print("["); boolean newLine = !oneLine; for (int i = 0; i < len; ++i) { if (newLine) { fWriter.println(); tabIfNeeded(); } - fWriter.print("\""/*nonNLS*/ + val[i] + "\""/*nonNLS*/); + fWriter.print("\"" + val[i] + "\""); if (i + 1 < len) { - fWriter.print(", "/*nonNLS*/); + fWriter.print(", "); } newLine = (i != 0 && (i % maxPerLine) == 0); } - fWriter.print("]"/*nonNLS*/); + fWriter.print("]"); if (oneLine || newLine) { fWriter.println(); } @@ -144,18 +144,18 @@ tabIfNeeded(); if (val instanceof IDumpable) { IDumpable dumpable = (IDumpable) val; - fWriter.println(classNameFor(val) + " {"/*nonNLS*/); + fWriter.println(classNameFor(val) + " {"); int originalLevel = fTabLevel; ++fTabLevel; try { dumpable.dump(this); } catch (Throwable t) { - fWriter.println("*ERR*"/*nonNLS*/); + fWriter.println("*ERR*"); } fTabLevel = originalLevel; tabIfNeeded(); - fWriter.println("}"/*nonNLS*/); + fWriter.println("}"); } else { fWriter.println(val); @@ -211,7 +211,7 @@ */ public void dump(String name, String val) { prefix(name); - fWriter.println(val == null ? "null"/*nonNLS*/ : "\""/*nonNLS*/ + val + "\""/*nonNLS*/); + fWriter.println(val == null ? "null" : "\"" + val + "\""); } /** * Dumps the given value, with the given name as a prefix. @@ -264,7 +264,7 @@ void prefix(String name) { tabIfNeeded(); fWriter.print(name); - fWriter.print(": "/*nonNLS*/); + fWriter.print(": "); } /** * Print an object directly, without a newline. @@ -289,7 +289,7 @@ */ void tabIfNeeded() { for (int i = 0; i < fTabLevel; ++i) { - fWriter.print(" "/*nonNLS*/); + fWriter.print(" "); } } }
diff --git a/model/org/eclipse/jdt/internal/core/util/HackFinder.java b/model/org/eclipse/jdt/internal/core/util/HackFinder.java index 71aae5a..a060884 100644 --- a/model/org/eclipse/jdt/internal/core/util/HackFinder.java +++ b/model/org/eclipse/jdt/internal/core/util/HackFinder.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public class HackFinder { /**
diff --git a/model/org/eclipse/jdt/internal/core/util/IComparator.java b/model/org/eclipse/jdt/internal/core/util/IComparator.java index 24dfa25..80b583d 100644 --- a/model/org/eclipse/jdt/internal/core/util/IComparator.java +++ b/model/org/eclipse/jdt/internal/core/util/IComparator.java
@@ -1,13 +1,5 @@ package org.eclipse.jdt.internal.core.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * An interface for comparing two objects according to a partial order. - */ public interface IComparator { /** * Returns an integer < 0 if o1 is less than o2, > 0 if o1 is greater
diff --git a/model/org/eclipse/jdt/internal/core/util/ILRUCacheable.java b/model/org/eclipse/jdt/internal/core/util/ILRUCacheable.java index 5b1e6d3..e73634a 100644 --- a/model/org/eclipse/jdt/internal/core/util/ILRUCacheable.java +++ b/model/org/eclipse/jdt/internal/core/util/ILRUCacheable.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.internal.core.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * Types implementing this interface can occupy a variable amount of space - * in an LRUCache. Cached items that do not implement this interface are - * considered to occupy one unit of space. - * - * @see LRUCache - */ public interface ILRUCacheable { /** * Returns the space the receiver consumes in an LRU Cache. The default space
diff --git a/model/org/eclipse/jdt/internal/core/util/IProgressListener.java b/model/org/eclipse/jdt/internal/core/util/IProgressListener.java index 226cb7c..ffce4a3 100644 --- a/model/org/eclipse/jdt/internal/core/util/IProgressListener.java +++ b/model/org/eclipse/jdt/internal/core/util/IProgressListener.java
@@ -1,27 +1,5 @@ package org.eclipse.jdt.internal.core.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** -The <code>IProgressListener</code> interface is implemented -by objects that monitor the progress of an activity. - -<p> All activity is broken down into a linear sequence of tasks against -which progress is reported. When a task begins, a <code>begin</code> -notification is reported, followed by any number and mixture of progress -reports (<code>worked()</code>) and subtask -notifications (<code>nowDoing()</code>). When the task -is eventually completed, a <code>done()</code> notification is reported. - -<p> Since notification is synchronous with the activity itself, -the listener should provide a fast and robust implementation. -If the handling of notifications would involve blocking operations, -or operations which might throw uncaught exceptions, the notifications -should be queued, and the actual processing delegated to a separate thread. - */ public interface IProgressListener { /** Notifies that the main task is beginning.
diff --git a/model/org/eclipse/jdt/internal/core/util/LRUCache.java b/model/org/eclipse/jdt/internal/core/util/LRUCache.java index fbac18a..933c6e1 100644 --- a/model/org/eclipse/jdt/internal/core/util/LRUCache.java +++ b/model/org/eclipse/jdt/internal/core/util/LRUCache.java
@@ -80,7 +80,7 @@ */ public String toString() { - return "LRUCacheEntry ["/*nonNLS*/ + _fKey + "-->"/*nonNLS*/ + _fValue + "]"/*nonNLS*/; + return "LRUCacheEntry [" + _fKey + "-->" + _fValue + "]"; } } @@ -444,7 +444,7 @@ */ public String toString() { return - "LRUCache "/*nonNLS*/ + (fCurrentSpace * 100.0 / fSpaceLimit) + "% full\n"/*nonNLS*/ + + "LRUCache " + (fCurrentSpace * 100.0 / fSpaceLimit) + "% full\n" + this.toStringContents(); } /** @@ -471,9 +471,9 @@ String toString = sorter.sortedStrings[i]; Object value = this.get(sorter.sortedObjects[i]); result.append(toString); - result.append(" -> "/*nonNLS*/); + result.append(" -> "); result.append(value); - result.append("\n"/*nonNLS*/); + result.append("\n"); } return result.toString(); }
diff --git a/model/org/eclipse/jdt/internal/core/util/LookupTable.java b/model/org/eclipse/jdt/internal/core/util/LookupTable.java index 74888e9..ee1bf5c 100644 --- a/model/org/eclipse/jdt/internal/core/util/LookupTable.java +++ b/model/org/eclipse/jdt/internal/core/util/LookupTable.java
@@ -62,7 +62,7 @@ entry = null; return next; } - throw new NoSuchElementException("LookupTable Enumerator"/*nonNLS*/); + throw new NoSuchElementException("LookupTable Enumerator"); } } /** @@ -94,10 +94,10 @@ */ public LookupTable(int initialCapacity, float loadFactor) { if (initialCapacity < 0) - throw new IllegalArgumentException("Illegal Capacity: "/*nonNLS*/+ + throw new IllegalArgumentException("Illegal Capacity: "+ initialCapacity); if (loadFactor <= 0) - throw new IllegalArgumentException("Illegal Load: "/*nonNLS*/+loadFactor); + throw new IllegalArgumentException("Illegal Load: "+loadFactor); if (initialCapacity==0) initialCapacity = 1; @@ -428,27 +428,27 @@ for (int i = 0; i < keys.length; ++i) { if (keys[i] == null) { if (values[i] != null) { - System.err.println("LookupTable sanity check in "/*nonNLS*/ + where + ": key is null, but value isn't at index "/*nonNLS*/ + i); + System.err.println("LookupTable sanity check in " + where + ": key is null, but value isn't at index " + i); throw new Error(); } } else { if (values[i] == null) { - System.err.println("LookupTable sanity check in "/*nonNLS*/ + where + ": value is null, but key isn't at index "/*nonNLS*/ + i); + System.err.println("LookupTable sanity check in " + where + ": value is null, but key isn't at index " + i); throw new Error(); } else { ++n; Object value = get(keys[i]); if (value == null || value != values[i]) { - System.err.println("LookupTable sanity check in "/*nonNLS*/ + where + ": key doesn't hash to proper value: "/*nonNLS*/ + keys[i]); + System.err.println("LookupTable sanity check in " + where + ": key doesn't hash to proper value: " + keys[i]); throw new Error(); } } } } if (n != count) { - System.err.println("LookupTable sanity check in "/*nonNLS*/ + where + ": count is "/*nonNLS*/ + count + " but there are "/*nonNLS*/ + n + " entries"/*nonNLS*/); + System.err.println("LookupTable sanity check in " + where + ": count is " + count + " but there are " + n + " entries"); throw new Error(); } } @@ -473,7 +473,7 @@ */ public synchronized String toString() { StringBuffer buf = new StringBuffer(); - buf.append("{"/*nonNLS*/); + buf.append("{"); boolean first = true; for (int i = 0, max = keys.length; i < max; i++) { if (keys[i] != null) { @@ -481,18 +481,18 @@ first = false; } else { - buf.append(", "/*nonNLS*/); + buf.append(", "); } if (buf.length() > 1000) { - buf.append("..."/*nonNLS*/); + buf.append("..."); break; } else { - buf.append(keys[i]).append("="/*nonNLS*/).append(values[i]); + buf.append(keys[i]).append("=").append(values[i]); } } } - buf.append("}"/*nonNLS*/); + buf.append("}"); return buf.toString(); } }
diff --git a/model/org/eclipse/jdt/internal/core/util/ReferenceInfoAdapter.java b/model/org/eclipse/jdt/internal/core/util/ReferenceInfoAdapter.java index 1ad3ebf..6c6e7c5 100644 --- a/model/org/eclipse/jdt/internal/core/util/ReferenceInfoAdapter.java +++ b/model/org/eclipse/jdt/internal/core/util/ReferenceInfoAdapter.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.core.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * An adapter which implements the methods for handling - * reference information from the parser. - */ public abstract class ReferenceInfoAdapter { /** * Does nothing.
diff --git a/model/org/eclipse/jdt/internal/core/util/StringHashtableOfInt.java b/model/org/eclipse/jdt/internal/core/util/StringHashtableOfInt.java index 6846b44..75cc7be 100644 --- a/model/org/eclipse/jdt/internal/core/util/StringHashtableOfInt.java +++ b/model/org/eclipse/jdt/internal/core/util/StringHashtableOfInt.java
@@ -1,13 +1,5 @@ package org.eclipse.jdt.internal.core.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A hash table keyed by strings and with int values. - */ public class StringHashtableOfInt { // to avoid using Enumerations, walk the individual tables skipping nulls public String[] keyTable; @@ -117,9 +109,9 @@ String key = this.keyTable[i]; if (key != null) { buffer.append(key); - buffer.append(" -> "/*nonNLS*/); + buffer.append(" -> "); buffer.append(this.valueTable[i]); - buffer.append("\n"/*nonNLS*/); + buffer.append("\n"); } } return buffer.toString();
diff --git a/model/org/eclipse/jdt/internal/core/util/StringMatcher.java b/model/org/eclipse/jdt/internal/core/util/StringMatcher.java index 3d161d9..84ed9ca 100644 --- a/model/org/eclipse/jdt/internal/core/util/StringMatcher.java +++ b/model/org/eclipse/jdt/internal/core/util/StringMatcher.java
@@ -229,9 +229,9 @@ * @param p, a String object that is a simple regular expression with ‘*’ and/or ‘?’ */ private void parseWildCards() { - if(fPattern.startsWith("*"/*nonNLS*/)) + if(fPattern.startsWith("*")) fHasLeadingStar = true; - if(fPattern.endsWith("*"/*nonNLS*/)) { + if(fPattern.endsWith("*")) { /* make sure it's not an escaped wildcard */ if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') { fHasTrailingStar = true;
diff --git a/model/org/eclipse/jdt/internal/core/util/ToStringSorter.java b/model/org/eclipse/jdt/internal/core/util/ToStringSorter.java index d2e6e66..ede2146 100644 --- a/model/org/eclipse/jdt/internal/core/util/ToStringSorter.java +++ b/model/org/eclipse/jdt/internal/core/util/ToStringSorter.java
@@ -1,28 +1,17 @@ package org.eclipse.jdt.internal.core.util; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * The SortOperation takes a collection of objects and returns - * a sorted collection of these objects. The sorting of these - * objects is based on their toString(). They are sorted in - * alphabetical order. - */ public class ToStringSorter { Object[] sortedObjects; String[] sortedStrings; /** - * Returns true if stringTwo is 'greater than' stringOne - * This is the 'ordering' method of the sort operation. + * Returns true if stringTwo is 'greater than' stringOne + * This is the 'ordering' method of the sort operation. */ public boolean compare(String stringOne, String stringTwo) { return stringOne.compareTo(stringTwo) < 0; } /** - * Sort the objects in sorted collection and return that collection. + * Sort the objects in sorted collection and return that collection. */ private void quickSort(int left, int right) { int originalLeft = left; @@ -54,15 +43,15 @@ quickSort(left, originalRight); } /** - * Return a new sorted collection from this unsorted collection. - * Sort using quick sort. + * Return a new sorted collection from this unsorted collection. + * Sort using quick sort. */ public void sort(Object[] unSortedObjects, String[] unsortedStrings) { int size = unSortedObjects.length; this.sortedObjects = new Object[size]; this.sortedStrings = new String[size]; - //copy the array so can return a new sorted collection + //copy the array so can return a new sorted collection System.arraycopy(unSortedObjects, 0, this.sortedObjects, 0, size); System.arraycopy(unsortedStrings, 0, this.sortedStrings, 0, size); if (size > 1)
diff --git a/search/org/eclipse/jdt/core/search/ITypeNameRequestor.java b/search/org/eclipse/jdt/core/search/ITypeNameRequestor.java index e20109e..4c17166 100644 --- a/search/org/eclipse/jdt/core/search/ITypeNameRequestor.java +++ b/search/org/eclipse/jdt/core/search/ITypeNameRequestor.java
@@ -1,19 +1,5 @@ package org.eclipse.jdt.core.search; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * A <code>ITypeNameRequestor<code> collects search results from a <code>searchAllTypeNames</code> - * query to a <code>SearchEngine</code>. Clients must implement this interface and pass - * an instance to the <code>searchAllTypeNames(...)</code> method. Only top-level and - * member types are reported. Local types are not reported. - * <p> - * This interface may be implemented by clients. - * </p> - */ public interface ITypeNameRequestor { /** * Accepts a top-level or a member class. @@ -21,13 +7,13 @@ * @param packageName the dot-separated name of the package of the class * @param simpleTypeName the simple name of the class * @param enclosingTypeNames if the class is a member type, - * the simple names of the enclosing types from the outer-most to the - * direct parent of the class (e.g. if the class is x.y.A$B$C then - * the enclosing types are [A, B]. This is an empty array if the class - * is a top-level type. + * the simple names of the enclosing types from the outer-most to the + * direct parent of the class (e.g. if the class is x.y.A$B$C then + * the enclosing types are [A, B]. This is an empty array if the class + * is a top-level type. * @param path the full path to the resource containing the class. If the resource is a .class file - * or a .java file, this is the full path in the workspace to this resource. If the - * resource is a .zip or .jar file, this is the full OS path to this file. + * or a .java file, this is the full path in the workspace to this resource. If the + * resource is a .zip or .jar file, this is the full OS path to this file. */ void acceptClass(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path); /** @@ -36,13 +22,13 @@ * @param packageName the dot-separated name of the package of the interface * @param simpleTypeName the simple name of the interface * @param enclosingTypeNames if the interface is a member type, - * the simple names of the enclosing types from the outer-most to the - * direct parent of the interface (e.g. if the interface is x.y.A$B$I then - * the enclosing types are [A, B]. This is an empty array if the interface - * is a top-level type. + * the simple names of the enclosing types from the outer-most to the + * direct parent of the interface (e.g. if the interface is x.y.A$B$I then + * the enclosing types are [A, B]. This is an empty array if the interface + * is a top-level type. * @param path the full path to the resource containing the interface. If the resource is a .class file - * or a .java file, this is the full path in the workspace to this resource. If the - * resource is a .zip or .jar file, this is the full OS path to this file. + * or a .java file, this is the full path in the workspace to this resource. If the + * resource is a .zip or .jar file, this is the full OS path to this file. */ void acceptInterface(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path); }
diff --git a/search/org/eclipse/jdt/core/search/SearchEngine.java b/search/org/eclipse/jdt/core/search/SearchEngine.java index ef7e758..f6df0d6 100644 --- a/search/org/eclipse/jdt/core/search/SearchEngine.java +++ b/search/org/eclipse/jdt/core/search/SearchEngine.java
@@ -19,7 +19,6 @@ import org.eclipse.jdt.internal.core.search.JavaWorkspaceScope; import org.eclipse.jdt.internal.core.search.PatternSearchJob; import org.eclipse.jdt.internal.core.search.PathCollector; -import org.eclipse.jdt.internal.core.search.Util; import org.eclipse.jdt.internal.core.search.indexing.*; import org.eclipse.jdt.internal.core.search.matching.*; @@ -246,7 +245,7 @@ /* initialize progress monitor */ IProgressMonitor progressMonitor = resultCollector.getProgressMonitor(); if (progressMonitor != null) { - progressMonitor.beginTask(Util.bind("engine.searching"/*nonNLS*/), 105); // 5 for getting paths, 100 for locating matches + progressMonitor.beginTask("Searching...", 105); // 5 for getting paths, 100 for locating matches } /* index search */ @@ -417,7 +416,7 @@ */ public void searchDeclarationsOfAccessedFields(IWorkspace workspace, IJavaElement enclosingElement, IJavaSearchResultCollector resultCollector) throws JavaModelException { MatchLocator locator = new MatchLocator( - (SearchPattern)createSearchPattern("*"/*nonNLS*/, IJavaSearchConstants.FIELD, IJavaSearchConstants.REFERENCES, true), + (SearchPattern)createSearchPattern("*", IJavaSearchConstants.FIELD, IJavaSearchConstants.REFERENCES, true), IInfoConstants.DeclarationInfo, resultCollector, new JavaWorkspaceScope()); @@ -464,7 +463,7 @@ */ public void searchDeclarationsOfReferencedTypes(IWorkspace workspace, IJavaElement enclosingElement, IJavaSearchResultCollector resultCollector) throws JavaModelException { MatchLocator locator = new MatchLocator( - (SearchPattern)createSearchPattern("*"/*nonNLS*/, IJavaSearchConstants.TYPE, IJavaSearchConstants.REFERENCES, true), + (SearchPattern)createSearchPattern("*", IJavaSearchConstants.TYPE, IJavaSearchConstants.REFERENCES, true), IInfoConstants.DeclarationInfo, resultCollector, new JavaWorkspaceScope()); @@ -514,7 +513,7 @@ */ public void searchDeclarationsOfSentMessages(IWorkspace workspace, IJavaElement enclosingElement, IJavaSearchResultCollector resultCollector) throws JavaModelException { MatchLocator locator = new MatchLocator( - (SearchPattern)createSearchPattern("*"/*nonNLS*/, IJavaSearchConstants.METHOD, IJavaSearchConstants.REFERENCES, true), + (SearchPattern)createSearchPattern("*", IJavaSearchConstants.METHOD, IJavaSearchConstants.REFERENCES, true), IInfoConstants.DeclarationInfo, resultCollector, new JavaWorkspaceScope());
diff --git a/search/org/eclipse/jdt/internal/core/index/IEntryResult.java b/search/org/eclipse/jdt/internal/core/index/IEntryResult.java index 3706d66..1e481f9 100644 --- a/search/org/eclipse/jdt/internal/core/index/IEntryResult.java +++ b/search/org/eclipse/jdt/internal/core/index/IEntryResult.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.index; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public interface IEntryResult { public int[] getFileReferences();
diff --git a/search/org/eclipse/jdt/internal/core/index/IIndexer.java b/search/org/eclipse/jdt/internal/core/index/IIndexer.java index 6d68928..15f3dad 100644 --- a/search/org/eclipse/jdt/internal/core/index/IIndexer.java +++ b/search/org/eclipse/jdt/internal/core/index/IIndexer.java
@@ -1,15 +1,5 @@ package org.eclipse.jdt.internal.core.index; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * An <code>IIndexer</code> indexes ONE document at each time. It adds the document names and - * the words references to an IIndex. Each IIndexer can index certain types of document, and should - * not index the other files. - */ public interface IIndexer { /** * Returns the file types the <code>IIndexer</code> handles.
diff --git a/search/org/eclipse/jdt/internal/core/index/IQueryResult.java b/search/org/eclipse/jdt/internal/core/index/IQueryResult.java index c2c1be1..901a98a 100644 --- a/search/org/eclipse/jdt/internal/core/index/IQueryResult.java +++ b/search/org/eclipse/jdt/internal/core/index/IQueryResult.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.index; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public interface IQueryResult { String getPath();
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/BlocksIndexInput.java b/search/org/eclipse/jdt/internal/core/index/impl/BlocksIndexInput.java index 67bf68d..7411051 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/BlocksIndexInput.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/BlocksIndexInput.java
@@ -5,7 +5,6 @@ * All Rights Reserved. */ import org.eclipse.jdt.internal.core.index.*; -import org.eclipse.jdt.internal.core.search.Util; import org.eclipse.jdt.internal.compiler.util.*; import java.io.*; @@ -190,10 +189,10 @@ public void open() throws IOException { if (!opened) { - raf= new SafeRandomAccessFile(indexFile, "r"/*nonNLS*/); + raf= new SafeRandomAccessFile(indexFile, "r"); String sig= raf.readUTF(); if (!sig.equals(IIndexConstants.SIGNATURE)) - throw new IOException(Util.bind("exception.wrongFormat"/*nonNLS*/)); + throw new IOException("Wrong format"); int summaryBlockNum= raf.readInt(); raf.seek(summaryBlockNum * (long) IIndexConstants.BLOCK_SIZE); summary= new IndexSummary();
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/BlocksIndexOutput.java b/search/org/eclipse/jdt/internal/core/index/impl/BlocksIndexOutput.java index a48657d..a0577e7 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/BlocksIndexOutput.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/BlocksIndexOutput.java
@@ -152,7 +152,7 @@ firstInBlock= true; firstIndexBlock= true; firstFileListBlock= true; - indexOut= new SafeRandomAccessFile(this.indexFile, "rw"/*nonNLS*/); + indexOut= new SafeRandomAccessFile(this.indexFile, "rw"); opened= true; } }
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/EntryResult.java b/search/org/eclipse/jdt/internal/core/index/impl/EntryResult.java index 8ede6b7..2dff506 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/EntryResult.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/EntryResult.java
@@ -46,15 +46,15 @@ } public String toString(){ StringBuffer buffer = new StringBuffer(word.length * 2); - buffer.append("EntryResult: word="/*nonNLS*/); + buffer.append("EntryResult: word="); buffer.append(word); - buffer.append(", refs={"/*nonNLS*/); + buffer.append(", refs={"); for (int i = 0; i < fileRefs.length; i++){ if (i > 0) buffer.append(','); buffer.append(' '); buffer.append(fileRefs[i]); } - buffer.append(" }"/*nonNLS*/); + buffer.append(" }"); return buffer.toString(); } }
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/FileDocument.java b/search/org/eclipse/jdt/internal/core/index/impl/FileDocument.java index 701ec78..975a818 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/FileDocument.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/FileDocument.java
@@ -48,7 +48,7 @@ public String getType() { int lastDot= file.getPath().lastIndexOf('.'); if (lastDot == -1) - return ""/*nonNLS*/; + return ""; return file.getPath().substring(lastDot + 1); } }
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/HashtableOfObject.java b/search/org/eclipse/jdt/internal/core/index/impl/HashtableOfObject.java index d1e22b0..41a966d 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/HashtableOfObject.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/HashtableOfObject.java
@@ -79,11 +79,11 @@ return elementSize; } public String toString() { - String s= ""/*nonNLS*/; + String s= ""; Object object; for (int i= 0, length= valueTable.length; i < length; i++) if ((object= valueTable[i]) != null) - s += new String(keyTable[i]) + " -> "/*nonNLS*/ + object.toString() + "\n"/*nonNLS*/; + s += new String(keyTable[i]) + " -> " + object.toString() + "\n"; return s; } }
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/IFileDocument.java b/search/org/eclipse/jdt/internal/core/index/impl/IFileDocument.java index 33b33d4..940dab2 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/IFileDocument.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/IFileDocument.java
@@ -75,7 +75,7 @@ public String getType() { String extension= file.getFileExtension(); if (extension == null) - return ""/*nonNLS*/; + return ""; return extension; } }
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/IIndexConstants.java b/search/org/eclipse/jdt/internal/core/index/impl/IIndexConstants.java index a1a1ce0..55fd6d3 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/IIndexConstants.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/IIndexConstants.java
@@ -1,18 +1,10 @@ package org.eclipse.jdt.internal.core.index.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * This interface provides constants used by the search engine. - */ public interface IIndexConstants { /** * The signature of the index file. */ - public static final String SIGNATURE= "INDEX FILE 0.001"/*nonNLS*/; + public static final String SIGNATURE= "INDEX FILE 0.001"; /** * The signature of the index file. */
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/ILRUCacheable.java b/search/org/eclipse/jdt/internal/core/index/impl/ILRUCacheable.java index 6be6df7..81dff3e 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/ILRUCacheable.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/ILRUCacheable.java
@@ -1,17 +1,5 @@ package org.eclipse.jdt.internal.core.index.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * Types implementing this interface can occupy a variable amount of space - * in an LRUCache. Cached items that do not implement this interface are - * considered to occupy one unit of space. - * - * @see LRUCache - */ public interface ILRUCacheable { /** * Returns the space the receiver consumes in an LRU Cache. The default space
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/Index.java b/search/org/eclipse/jdt/internal/core/index/impl/Index.java index f989c1f..4148024 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/Index.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/Index.java
@@ -53,7 +53,7 @@ */ private String toString; public Index(File indexDirectory) throws IOException { - this(indexDirectory,".index"/*nonNLS*/); + this(indexDirectory,".index"); } public Index(File indexDirectory, String indexName) throws IOException { super(); @@ -215,7 +215,7 @@ //System.out.println("merge"); //initialisation of tempIndex - File tempFile= new File(indexFile.getAbsolutePath() + "TempVA"/*nonNLS*/); + File tempFile= new File(indexFile.getAbsolutePath() + "TempVA"); boolean exists= indexFile.exists(); IndexInput mainIndexInput= new BlocksIndexInput(indexFile);
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/IndexInput.java b/search/org/eclipse/jdt/internal/core/index/impl/IndexInput.java index b371386..5bb973b 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/IndexInput.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/IndexInput.java
@@ -1,6 +1,5 @@ package org.eclipse.jdt.internal.core.index.impl; - /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. @@ -8,7 +7,6 @@ import java.io.*; import org.eclipse.jdt.internal.core.index.*; - /** * This class provides an input on an index, after it has been generated.<br> * You can access all the files of an index via getNextFile(), getCurrentFile() @@ -18,13 +16,11 @@ * data source used by this input. */ - public abstract class IndexInput { protected int filePosition; protected WordEntry currentWordEntry; protected int wordPosition; - public IndexInput() { super(); wordPosition= 1; @@ -105,6 +101,12 @@ * Open the Source where the input gets the information from. */ public abstract void open() throws IOException; + public void printStats(PrintStream out) { + out.println("Index stats :"); + int numFiles= getNumFiles(); + out.println(" files: " + numFiles); + out.println(" total words indexed (unique): " + this.getNumWords()); + } /** * Returns the list of the files containing the given word in the index. */
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/IndexSummary.java b/search/org/eclipse/jdt/internal/core/index/impl/IndexSummary.java index b5cf187..fda0669 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/IndexSummary.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/IndexSummary.java
@@ -45,7 +45,7 @@ char[] word; int blockNum; public String toString(){ - return "FirstWordInBlock: "/*nonNLS*/ + new String(word) + ", blockNum: "/*nonNLS*/ + blockNum; + return "FirstWordInBlock: " + new String(word) + ", blockNum: " +blockNum; } }
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/IndexedFile.java b/search/org/eclipse/jdt/internal/core/index/impl/IndexedFile.java index d115c7d..0f5256c 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/IndexedFile.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/IndexedFile.java
@@ -20,10 +20,10 @@ public class IndexedFile implements IQueryResult { protected String path; protected int fileNumber; - protected static final String INFO_BEGIN= "("/*nonNLS*/; - protected static final String INFO_END= ")"/*nonNLS*/; - protected static final String INFO_SEPARATOR= ","/*nonNLS*/; - protected static final String INFO_VALUE_SEPARATOR= ":"/*nonNLS*/; + protected static final String INFO_BEGIN= "("; + protected static final String INFO_END= ")"; + protected static final String INFO_SEPARATOR= ","; + protected static final String INFO_VALUE_SEPARATOR= ":"; protected static final int MAX_PROPERTIES_SIZE= 2 * 1024; protected Hashtable properties; protected int propertiesSize= 2 * (INFO_BEGIN.length() + INFO_END.length()); @@ -131,7 +131,7 @@ } public String propertiesToString() { if (properties.isEmpty()) - return ""/*nonNLS*/; + return ""; StringBuffer prop= new StringBuffer(INFO_BEGIN); for (Enumeration e= getPropertyNames(); e.hasMoreElements();) { String property= (String) e.nextElement(); @@ -160,6 +160,6 @@ properties.put(propertyName, value); } public String toString() { - return "IndexedFile("/*nonNLS*/ + fileNumber + ": "/*nonNLS*/ + path + ")"/*nonNLS*/; + return "IndexedFile(" + fileNumber + ": " + path + ")"; } }
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/Int.java b/search/org/eclipse/jdt/internal/core/index/impl/Int.java index 500b7ea..0a09b95 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/Int.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/Int.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.index.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public class Int { public int value;
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/JarFileDocument.java b/search/org/eclipse/jdt/internal/core/index/impl/JarFileDocument.java index bae4d88..f689a1f 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/JarFileDocument.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/JarFileDocument.java
@@ -56,7 +56,7 @@ public String getType() { String extension= file.getFileExtension(); if (extension == null) - return ""/*nonNLS*/; + return ""; return extension; } }
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/JarFileEntryDocument.java b/search/org/eclipse/jdt/internal/core/index/impl/JarFileEntryDocument.java index db9f920..d8dd5fe 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/JarFileEntryDocument.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/JarFileEntryDocument.java
@@ -19,7 +19,7 @@ protected ZipEntry zipEntry; protected byte[] byteContents; protected Path zipFilePath; - public static final String JAR_FILE_ENTRY_SEPARATOR = "|"/*nonNLS*/; + public static final String JAR_FILE_ENTRY_SEPARATOR = "|"; /** * JarFileEntryDocument constructor comment. */ @@ -59,7 +59,7 @@ * @see IDocument#getType */ public String getType() { - return "class"/*nonNLS*/; + return "class"; } public void setBytes(byte[] byteContents) { this.byteContents = byteContents;
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/LRUCache.java b/search/org/eclipse/jdt/internal/core/index/impl/LRUCache.java index 7ca6386..cdf8025 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/LRUCache.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/LRUCache.java
@@ -86,7 +86,7 @@ */ public String toString() { - return "LRUCacheEntry ["/*nonNLS*/ + _fKey + "-->"/*nonNLS*/ + _fValue + "]"/*nonNLS*/; + return "LRUCacheEntry [" + _fKey + "-->" + _fValue + "]"; } } @@ -451,7 +451,7 @@ */ public String toString() { - return "LRUCache "/*nonNLS*/ + (getCurrentSpace() * 100.0 / getSpaceLimit()) + "% full"/*nonNLS*/; + return "LRUCache " + (getCurrentSpace() * 100.0 / getSpaceLimit()) + "% full"; } /** * Updates the timestamp for the given entry, ensuring that the queue is
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/MemoryCheckThread.java b/search/org/eclipse/jdt/internal/core/index/impl/MemoryCheckThread.java index 96f708b..04bcfaf 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/MemoryCheckThread.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/MemoryCheckThread.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.index.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public class MemoryCheckThread extends Thread { Runtime rt= Runtime.getRuntime();
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/ObjectVector.java b/search/org/eclipse/jdt/internal/core/index/impl/ObjectVector.java index a65cd3b..bd7ba12 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/ObjectVector.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/ObjectVector.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.index.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public final class ObjectVector { static int INITIAL_SIZE= 10; @@ -61,9 +56,9 @@ size= 0; } public String toString() { - String s= ""/*nonNLS*/; + String s= ""; for (int i= 0; i < size; i++) - s += elements[i].toString() + "\n"/*nonNLS*/; + s += elements[i].toString() + "\n"; return s; } }
diff --git a/search/org/eclipse/jdt/internal/core/index/impl/WordEntry.java b/search/org/eclipse/jdt/internal/core/index/impl/WordEntry.java index 477ca4c..70b24ed 100644 --- a/search/org/eclipse/jdt/internal/core/index/impl/WordEntry.java +++ b/search/org/eclipse/jdt/internal/core/index/impl/WordEntry.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.index.impl; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public class WordEntry { protected char[] fWord;
diff --git a/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java b/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java index 6e468c8..8c5b531 100644 --- a/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java +++ b/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java
@@ -67,7 +67,7 @@ zipFileName + JAR_FILE_ENTRY_SEPARATOR + type.getFullyQualifiedName().replace('.', '/') + - ".class"/*nonNLS*/; + ".class"; this.resourcePaths.put(resourcePath, resourcePath); paths.put(jar.getPath(), type); } else {
diff --git a/search/org/eclipse/jdt/internal/core/search/IIndexSearchRequestor.java b/search/org/eclipse/jdt/internal/core/search/IIndexSearchRequestor.java index 6a0cd78..5790017 100644 --- a/search/org/eclipse/jdt/internal/core/search/IIndexSearchRequestor.java +++ b/search/org/eclipse/jdt/internal/core/search/IIndexSearchRequestor.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.search; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public interface IIndexSearchRequestor { /**
diff --git a/search/org/eclipse/jdt/internal/core/search/IInfoConstants.java b/search/org/eclipse/jdt/internal/core/search/IInfoConstants.java index 19b10ff..ca53e87 100644 --- a/search/org/eclipse/jdt/internal/core/search/IInfoConstants.java +++ b/search/org/eclipse/jdt/internal/core/search/IInfoConstants.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.search; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public interface IInfoConstants { /* granularity of search results */
diff --git a/search/org/eclipse/jdt/internal/core/search/IndexSearchAdapter.java b/search/org/eclipse/jdt/internal/core/search/IndexSearchAdapter.java index c64a89c..84601b9 100644 --- a/search/org/eclipse/jdt/internal/core/search/IndexSearchAdapter.java +++ b/search/org/eclipse/jdt/internal/core/search/IndexSearchAdapter.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.search; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public class IndexSearchAdapter implements IIndexSearchRequestor { /**
diff --git a/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java b/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java index 5d3a2a4..3c9d79f 100644 --- a/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java +++ b/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java
@@ -74,7 +74,7 @@ isComplete &= search(searchIndexes[i]); } if (JobManager.VERBOSE){ - System.out.println("-> execution time: "/*nonNLS*/ + executionTime + " ms. for : "/*nonNLS*/+this); + System.out.println("-> execution time: " + executionTime + " ms. for : "+this); } return isComplete; } @@ -96,7 +96,7 @@ try { monitor.exitRead(); // free read lock monitor.enterWrite(); // ask permission to write - if (IndexManager.VERBOSE) System.out.println("-> merging index : "/*nonNLS*/+index.getIndexFile()); + if (IndexManager.VERBOSE) System.out.println("-> merging index : "+index.getIndexFile()); index.save(); } catch(IOException e){ return FAILED; @@ -116,6 +116,6 @@ } } public String toString(){ - return "searching "/*nonNLS*/ + pattern.toString(); + return "searching " + pattern.toString(); } }
diff --git a/search/org/eclipse/jdt/internal/core/search/SubTypeSearchJob.java b/search/org/eclipse/jdt/internal/core/search/SubTypeSearchJob.java index a24d5c6..28ded25 100644 --- a/search/org/eclipse/jdt/internal/core/search/SubTypeSearchJob.java +++ b/search/org/eclipse/jdt/internal/core/search/SubTypeSearchJob.java
@@ -56,7 +56,7 @@ try { monitor.exitRead(); // free read lock monitor.enterWrite(); // ask permission to write - if (IndexManager.VERBOSE) System.out.println("-> merging index : "/*nonNLS*/+index.getIndexFile()); + if (IndexManager.VERBOSE) System.out.println("-> merging index : "+index.getIndexFile()); index.save(); } catch(IOException e){ return FAILED;
diff --git a/search/org/eclipse/jdt/internal/core/search/indexing/AddClassFileToIndex.java b/search/org/eclipse/jdt/internal/core/search/indexing/AddClassFileToIndex.java index 3f6d3ed..ecadacf 100644 --- a/search/org/eclipse/jdt/internal/core/search/indexing/AddClassFileToIndex.java +++ b/search/org/eclipse/jdt/internal/core/search/indexing/AddClassFileToIndex.java
@@ -68,6 +68,6 @@ } } public String toString(){ - return "indexing "/*nonNLS*/ + resource.getName(); + return "indexing " + resource.getName(); } }
diff --git a/search/org/eclipse/jdt/internal/core/search/indexing/AddCompilationUnitToIndex.java b/search/org/eclipse/jdt/internal/core/search/indexing/AddCompilationUnitToIndex.java index 5b1bd84..41dc2df 100644 --- a/search/org/eclipse/jdt/internal/core/search/indexing/AddCompilationUnitToIndex.java +++ b/search/org/eclipse/jdt/internal/core/search/indexing/AddCompilationUnitToIndex.java
@@ -69,6 +69,6 @@ } } public String toString(){ - return "indexing "/*nonNLS*/ + resource.getName(); + return "indexing " + resource.getName(); } }
diff --git a/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java b/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java index bc57a19..54da1f0 100644 --- a/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java +++ b/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java
@@ -73,11 +73,11 @@ } if (JobManager.VERBOSE) - System.out.println("INDEX : "/*nonNLS*/ + zip.getName()); + System.out.println("INDEX : " + zip.getName()); long initialTime = System.currentTimeMillis(); final Hashtable indexedFileNames = new Hashtable(100); - IQueryResult[] results = index.queryInDocumentNames(""/*nonNLS*/); // all file names + IQueryResult[] results = index.queryInDocumentNames(""); // all file names int resultLength = results == null ? 0 : results.length; if (resultLength != 0) { /* check integrity of the existing index file @@ -135,11 +135,11 @@ } if (JobManager.VERBOSE) System.out.println( - "INDEX : "/*nonNLS*/ + "INDEX : " + zip.getName() - + " COMPLETE in "/*nonNLS*/ + + " COMPLETE in " + (System.currentTimeMillis() - initialTime) - + " ms"/*nonNLS*/); + + " ms"); } finally { if (zip != null) zip.close(); @@ -160,12 +160,12 @@ if (resource != null) { IPath location = resource.getLocation(); if (location == null){ - toString = "indexing "/*nonNLS*/; + toString = "indexing "; } else { - toString = "indexing "/*nonNLS*/ + location.toFile().toString(); + toString = "indexing " + location.toFile().toString(); } } else { - toString = "indexing "/*nonNLS*/ + this.path.toFile().toString(); + toString = "indexing " + this.path.toFile().toString(); } } return toString;
diff --git a/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java b/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java index e9756c4..2ade21d 100644 --- a/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java +++ b/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java
@@ -13,16 +13,16 @@ import java.util.zip.*; public class BinaryIndexer extends AbstractIndexer { - public static final String[] FILE_TYPES= new String[] {"class"/*nonNLS*/}; - private static final char[] BYTE = "byte"/*nonNLS*/.toCharArray(); - private static final char[] CHAR = "char"/*nonNLS*/.toCharArray(); - private static final char[] DOUBLE = "double"/*nonNLS*/.toCharArray(); - private static final char[] FLOAT = "float"/*nonNLS*/.toCharArray(); - private static final char[] INT = "int"/*nonNLS*/.toCharArray(); - private static final char[] LONG = "long"/*nonNLS*/.toCharArray(); - private static final char[] SHORT = "short"/*nonNLS*/.toCharArray(); - private static final char[] BOOLEAN = "boolean"/*nonNLS*/.toCharArray(); - private static final char[] VOID = "void"/*nonNLS*/.toCharArray(); + public static final String[] FILE_TYPES= new String[] {"class"}; + private static final char[] BYTE = "byte".toCharArray(); + private static final char[] CHAR = "char".toCharArray(); + private static final char[] DOUBLE = "double".toCharArray(); + private static final char[] FLOAT = "float".toCharArray(); + private static final char[] INT = "int".toCharArray(); + private static final char[] LONG = "long".toCharArray(); + private static final char[] SHORT = "short".toCharArray(); + private static final char[] BOOLEAN = "boolean".toCharArray(); + private static final char[] VOID = "void".toCharArray(); private boolean needReferences; @@ -442,14 +442,14 @@ char[][] superinterfaces = replace('/', '.', reader.getInterfaceNames()); if (DEBUG) { if (packageName != null) { - System.out.println("package name = "/*nonNLS*/ + new String(packageName)); + System.out.println("package name = " + new String(packageName)); } if (name != null) { - System.out.println("class name = "/*nonNLS*/ + new String(name)); + System.out.println("class name = " + new String(name)); } if (superinterfaces != null) { for (int i = 0, max = superinterfaces.length; i < max; i++) { - System.out.println("superinterfaces["/*nonNLS*/ + i + "]= "/*nonNLS*/ + new String(superinterfaces[i])); + System.out.println("superinterfaces[" + i + "]= " + new String(superinterfaces[i])); } } } @@ -460,7 +460,7 @@ char[] superclass = replace('/', '.', reader.getSuperclassName()); if (DEBUG) { if (superclass != null) { - System.out.println("superclass name = "/*nonNLS*/ + new String(superclass)); + System.out.println("superclass name = " + new String(superclass)); } } addClassDeclaration(reader.getModifiers(), packageName, name, enclosingTypeNames, superclass, superinterfaces); @@ -477,19 +477,19 @@ char[][] exceptionTypes = replace('/', '.', method.getExceptionTypeNames()); if (DEBUG) { if (method.getSelector() != null) { - System.out.println("method selector = "/*nonNLS*/ + new String(method.getSelector())); + System.out.println("method selector = " + new String(method.getSelector())); } if (parameterTypes != null) { for (int j = 0, max2 = parameterTypes.length; j < max2; j++) { - System.out.println("parameterTypes["/*nonNLS*/ + j + "]= "/*nonNLS*/ + new String(parameterTypes[j])); + System.out.println("parameterTypes[" + j + "]= " + new String(parameterTypes[j])); } } if (returnType != null) { - System.out.println("return type = "/*nonNLS*/ + new String(returnType)); + System.out.println("return type = " + new String(returnType)); } if (exceptionTypes != null) { for (int j = 0, max2 = exceptionTypes.length; j < max2; j++) { - System.out.println("exceptionTypes["/*nonNLS*/ + j + "]= "/*nonNLS*/ + new String(exceptionTypes[j])); + System.out.println("exceptionTypes[" + j + "]= " + new String(exceptionTypes[j])); } } } @@ -510,10 +510,10 @@ char[] fieldType = decodeFieldType(replace('/', '.', field.getTypeName())); if (DEBUG) { if (fieldName != null) { - System.out.println("field name = "/*nonNLS*/ + new String(fieldName)); + System.out.println("field name = " + new String(fieldName)); } if (fieldType != null) { - System.out.println("field type = "/*nonNLS*/ + new String(fieldType)); + System.out.println("field type = " + new String(fieldType)); } } addFieldDeclaration(fieldType, fieldName);
diff --git a/search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java b/search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java index e74bdad..1397c72 100644 --- a/search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java +++ b/search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java
@@ -9,20 +9,20 @@ public interface IIndexConstants extends IJobConstants { /* index encoding */ - char[] REF= "ref/"/*nonNLS*/.toCharArray(); - char[] FIELD_REF= "fieldRef/"/*nonNLS*/.toCharArray(); - char[] METHOD_REF= "methodRef/"/*nonNLS*/.toCharArray(); - char[] CONSTRUCTOR_REF= "constructorRef/"/*nonNLS*/.toCharArray(); - char[] TYPE_REF= "typeRef/"/*nonNLS*/.toCharArray(); - char[] SUPER_REF = "superRef/"/*nonNLS*/.toCharArray(); - char[] TYPE_DECL = "typeDecl/"/*nonNLS*/.toCharArray(); + char[] REF= "ref/".toCharArray(); + char[] FIELD_REF= "fieldRef/".toCharArray(); + char[] METHOD_REF= "methodRef/".toCharArray(); + char[] CONSTRUCTOR_REF= "constructorRef/".toCharArray(); + char[] TYPE_REF= "typeRef/".toCharArray(); + char[] SUPER_REF = "superRef/".toCharArray(); + char[] TYPE_DECL = "typeDecl/".toCharArray(); int TYPE_DECL_LENGTH = 9; - char[] CLASS_DECL= "typeDecl/C/"/*nonNLS*/.toCharArray(); - char[] INTERFACE_DECL= "typeDecl/I/"/*nonNLS*/.toCharArray(); - char[] METHOD_DECL= "methodDecl/"/*nonNLS*/.toCharArray(); - char[] CONSTRUCTOR_DECL= "constructorDecl/"/*nonNLS*/.toCharArray(); - char[] FIELD_DECL= "fieldDecl/"/*nonNLS*/.toCharArray(); - char[] OBJECT = "Object"/*nonNLS*/.toCharArray(); + char[] CLASS_DECL= "typeDecl/C/".toCharArray(); + char[] INTERFACE_DECL= "typeDecl/I/".toCharArray(); + char[] METHOD_DECL= "methodDecl/".toCharArray(); + char[] CONSTRUCTOR_DECL= "constructorDecl/".toCharArray(); + char[] FIELD_DECL= "fieldDecl/".toCharArray(); + char[] OBJECT = "Object".toCharArray(); char[][] COUNTS= new char[][] { new char[] {'0'}, new char[] {'1'}, new char[] {'2'}, new char[] {'3'}, new char[] {'4'}, new char[] {'5'}, new char[] {'6'}, new char[] {'7'}, new char[] {'8'}, new char[] {'9'} };
diff --git a/search/org/eclipse/jdt/internal/core/search/indexing/IndexAllProject.java b/search/org/eclipse/jdt/internal/core/search/indexing/IndexAllProject.java index b51827b..6f33dcb 100644 --- a/search/org/eclipse/jdt/internal/core/search/indexing/IndexAllProject.java +++ b/search/org/eclipse/jdt/internal/core/search/indexing/IndexAllProject.java
@@ -45,7 +45,7 @@ try { monitor.exitRead(); // free read lock monitor.enterWrite(); // ask permission to write - if (IndexManager.VERBOSE) System.out.println("-> merging index : "/*nonNLS*/+index.getIndexFile()); + if (IndexManager.VERBOSE) System.out.println("-> merging index : "+index.getIndexFile()); index.save(); } catch(IOException e){ return FAILED; @@ -54,12 +54,12 @@ monitor.enterRead(); // reacquire read permission } } - final String OK = "OK"/*nonNLS*/; - final String DELETED = "DELETED"/*nonNLS*/; + final String OK = "OK"; + final String DELETED = "DELETED"; final long indexLastModified = index.getIndexFile().lastModified(); final Hashtable indexedFileNames = new Hashtable(100); - IQueryResult[] results = index.queryInDocumentNames(""/*nonNLS*/); // all file names + IQueryResult[] results = index.queryInDocumentNames(""); // all file names for (int i = 0, max = results == null ? 0 : results.length; i < max; i++){ String fileName = results[i].getPath(); indexedFileNames.put(fileName, DELETED); @@ -68,7 +68,7 @@ public boolean visit(IResource resource) { if (resource.getType() == IResource.FILE) { String extension = resource.getFileExtension(); - if ((extension != null) && extension.equalsIgnoreCase("java"/*nonNLS*/)) { + if ((extension != null) && extension.equalsIgnoreCase("java")) { IPath path = resource.getLocation(); if (path != null){ File resourceFile = path.toFile(); @@ -108,6 +108,6 @@ return COMPLETE; } public String toString(){ - return "indexing project "/*nonNLS*/ + project.getName(); + return "indexing project "+ project.getName(); } }
diff --git a/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java b/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java index c56c431..2050fe9 100644 --- a/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java +++ b/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java
@@ -12,7 +12,6 @@ import org.eclipse.jdt.internal.core.index.*; import org.eclipse.jdt.core.search.*; import org.eclipse.jdt.internal.core.search.indexing.*; -import org.eclipse.jdt.internal.core.search.Util; import org.eclipse.jdt.internal.core.search.processing.*; import org.eclipse.jdt.internal.core.*; import org.eclipse.jdt.internal.core.index.impl.*; @@ -48,7 +47,6 @@ } catch (InterruptedException ie) { } checkIndexConsistency(); - super.activateProcessing(); } /** * Trigger addition of a resource to an index @@ -57,13 +55,13 @@ public void add(IFile resource){ if (JavaCore.getPlugin() == null || this.workspace == null) return; String extension = resource.getFileExtension(); - if ("java"/*nonNLS*/.equals(extension)){ + if ("java".equals(extension)){ AddCompilationUnitToIndex job = new AddCompilationUnitToIndex(resource, this); if (this.awaitingJobsCount() < MAX_FILES_IN_MEMORY) { job.initializeContents(); } request(job); - } else if ("class"/*nonNLS*/.equals(extension)){ + } else if ("class".equals(extension)){ AddClassFileToIndex job = new AddClassFileToIndex(resource, this); if (this.awaitingJobsCount() < MAX_FILES_IN_MEMORY) { job.initializeContents(); @@ -77,7 +75,7 @@ */ public void checkIndexConsistency() { - if (VERBOSE) System.out.println("STARTING - ensuring consistency"/*nonNLS*/); + if (VERBOSE) System.out.println("STARTING - ensuring consistency"); boolean wasEnabled = isEnabled(); try { @@ -94,15 +92,15 @@ } } finally { if (wasEnabled) enable(); - if (VERBOSE) System.out.println("DONE - ensuring consistency"/*nonNLS*/); + if (VERBOSE) System.out.println("DONE - ensuring consistency"); } } private String computeIndexName(String pathString) { byte[] pathBytes = pathString.getBytes(); checksumCalculator.reset(); checksumCalculator.update(pathBytes); - String fileName = Long.toString(checksumCalculator.getValue()) + ".index"/*nonNLS*/; - if (VERBOSE) System.out.println(" index name: "/*nonNLS*/ + pathString + " <----> "/*nonNLS*/ + fileName); + String fileName = Long.toString(checksumCalculator.getValue()) + ".index"; + if (VERBOSE) System.out.println(" index name: " + pathString + " <----> " + fileName); IPath indexPath = getJavaPluginWorkingLocation(); String indexDirectory = indexPath.toOSString(); if (indexDirectory.endsWith(File.separator)) { @@ -183,7 +181,7 @@ if (index == null) { // New index: add same index for given path and canonical path String indexPath = computeIndexName(canonicalPath.toOSString()); - index = IndexFactory.newIndex(indexPath, "Index for "/*nonNLS*/ + canonicalPath.toOSString()); + index = IndexFactory.newIndex(indexPath, "Index for " + canonicalPath.toOSString()); indexes.put(canonicalPath, index); indexes.put(path, index); monitors.put(index, new ReadWriteMonitor()); @@ -257,7 +255,7 @@ * Name of the background process */ public String processName(){ - return Util.bind("process.name"/*nonNLS*/, IndexManager.class.getName()); + return "Java indexing: " + IndexManager.class.getName(); } /** * Recreates the index for a given path, keeping the same read-write monitor. @@ -273,7 +271,7 @@ // Add same index for given path and canonical path String indexPath = computeIndexName(canonicalPath.toOSString()); ReadWriteMonitor monitor = (ReadWriteMonitor)monitors.remove(index); - index = IndexFactory.newIndex(indexPath, "Index for "/*nonNLS*/ + canonicalPath.toOSString()); + index = IndexFactory.newIndex(indexPath, "Index for " + canonicalPath.toOSString()); index.empty(); indexes.put(canonicalPath, index); indexes.put(path, index); @@ -318,7 +316,7 @@ if (monitor == null) continue; // index got deleted since acquired try { monitor.enterWrite(); - if (IndexManager.VERBOSE) System.out.println("-> merging index : "/*nonNLS*/+index.getIndexFile()); + if (IndexManager.VERBOSE) System.out.println("-> merging index : "+index.getIndexFile()); index.save(); } finally { monitor.exitWrite();
diff --git a/search/org/eclipse/jdt/internal/core/search/indexing/ReadWriteMonitor.java b/search/org/eclipse/jdt/internal/core/search/indexing/ReadWriteMonitor.java index 62fc337..c2e027d 100644 --- a/search/org/eclipse/jdt/internal/core/search/indexing/ReadWriteMonitor.java +++ b/search/org/eclipse/jdt/internal/core/search/indexing/ReadWriteMonitor.java
@@ -1,14 +1,5 @@ package org.eclipse.jdt.internal.core.search.indexing; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; -/** - * Monitor ensuring no more than one writer working concurrently. - * Multiple readers are allowed to perform simultaneously. - */ public class ReadWriteMonitor { /**
diff --git a/search/org/eclipse/jdt/internal/core/search/indexing/RemoveFromIndex.java b/search/org/eclipse/jdt/internal/core/search/indexing/RemoveFromIndex.java index a03484a..067c3d2 100644 --- a/search/org/eclipse/jdt/internal/core/search/indexing/RemoveFromIndex.java +++ b/search/org/eclipse/jdt/internal/core/search/indexing/RemoveFromIndex.java
@@ -48,6 +48,6 @@ return COMPLETE; } public String toString(){ - return "removing from index "/*nonNLS*/ + resourceName; + return "removing from index "+resourceName; } }
diff --git a/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java b/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java index 62853a9..db9a6f5 100644 --- a/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java +++ b/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java
@@ -31,7 +31,7 @@ */ public class SourceIndexer extends AbstractIndexer { - public static final String[] FILE_TYPES= new String[] {"java"/*nonNLS*/}; + public static final String[] FILE_TYPES= new String[] {"java"}; protected DefaultProblemFactory problemFactory= new DefaultProblemFactory(Locale.getDefault()); /**
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java b/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java index 0b842a2..dfd2747 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java
@@ -60,6 +60,85 @@ isCaseSensitive); } /** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + if (!(node instanceof ConstructorDeclaration)) return false; + + ConstructorDeclaration constructor = (ConstructorDeclaration)node; + + // constructor name is stored in selector field + if (this.declaringSimpleName != null + && !this.matchesName(this.declaringSimpleName, constructor.selector)) + return false; + + // declaring type + MethodBinding binding = constructor.binding; + if (resolve && binding != null) { + ReferenceBinding declaringBinding = binding.declaringClass; + if (!this.matchesType(this.declaringSimpleName, this.declaringQualification, declaringBinding)) + return false; + } + + // argument types + int argumentCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; + if (argumentCount > -1) { + int parameterCount = constructor.arguments == null ? 0 : constructor.arguments.length; + if (parameterCount != argumentCount) + return false; + + if (resolve && binding != null) { + for (int i = 0; i < parameterCount; i++) { + char[] qualification = this.parameterQualifications[i]; + char[] type = this.parameterSimpleNames[i]; + if (!this.matchesType(type, qualification, binding.parameters[i])) + return false; + } + } + } + + return true; +} +/** + * @see SearchPattern#matches(Binding) + */ +public boolean matches(Binding binding) { + if (!(binding instanceof MethodBinding)) return false; + + MethodBinding method = (MethodBinding)binding; + + // must be a constructor + if (!method.isConstructor()) return false; + + // declaring type + ReferenceBinding declaringType = method.declaringClass; + if (declaringType != null) { + if (!method.isStatic() && !method.isPrivate()) { + if (!this.matchesAsSubtype(declaringType, this.declaringSimpleName, this.declaringQualification)) + return false; + } else { + if (!this.matchesType(this.declaringSimpleName, this.declaringQualification, declaringType)) + return false; + } + } + + // parameter types + int parameterCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; + if (parameterCount > -1) { + int argumentCount = method.parameters == null ? 0 : method.parameters.length; + if (parameterCount != argumentCount) + return false; + for (int i = 0; i < parameterCount; i++) { + char[] qualification = this.parameterQualifications[i]; + char[] type = this.parameterSimpleNames[i]; + if (!this.matchesType(type, qualification, method.parameters[i])) + return false; + } + } + + return true; +} +/** * @see SearchPattern#matchesBinary(Object, Object) */ public boolean matchesBinary(Object binaryInfo, Object enclosingBinaryInfo) { @@ -130,116 +209,39 @@ public String toString(){ StringBuffer buffer = new StringBuffer(20); - buffer.append("ConstructorDeclarationPattern: "/*nonNLS*/); + buffer.append("ConstructorDeclarationPattern: "); if (declaringQualification != null) buffer.append(declaringQualification).append('.'); if (declaringSimpleName != null) buffer.append(declaringSimpleName); - else if (declaringQualification != null) buffer.append("*"/*nonNLS*/); + else if (declaringQualification != null) buffer.append("*"); buffer.append('('); if (parameterSimpleNames == null) { - buffer.append("..."/*nonNLS*/); + buffer.append("..."); } else { for (int i = 0, max = parameterSimpleNames.length; i < max; i++){ - if (i > 0) buffer.append(", "/*nonNLS*/); + if (i > 0) buffer.append(", "); if (parameterQualifications[i] != null) buffer.append(parameterQualifications[i]).append('.'); if (parameterSimpleNames[i] == null) buffer.append('*'); else buffer.append(parameterSimpleNames[i]); } } buffer.append(')'); - buffer.append(", "/*nonNLS*/); + buffer.append(", "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } - -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - if (!(node instanceof ConstructorDeclaration)) return IMPOSSIBLE_MATCH; - - ConstructorDeclaration constructor = (ConstructorDeclaration)node; - - if (resolve) { - return this.matchLevel(constructor.binding); - } else { - // constructor name is stored in selector field - if (this.declaringSimpleName != null - && !this.matchesName(this.declaringSimpleName, constructor.selector)) - return IMPOSSIBLE_MATCH; - - // parameter types - int parameterCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; - if (parameterCount > -1) { - int argumentCount = constructor.arguments == null ? 0 : constructor.arguments.length; - if (parameterCount != argumentCount) - return IMPOSSIBLE_MATCH; - } - - return POSSIBLE_MATCH; - } -} - -/** - * @see SearchPattern#matchLevel(Binding) - */ -public int matchLevel(Binding binding) { - if (binding == null) return INACCURATE_MATCH; - if (!(binding instanceof MethodBinding)) return IMPOSSIBLE_MATCH; - int level; - - MethodBinding constructor = (MethodBinding)binding; - - // must be a constructor - if (!constructor.isConstructor()) return IMPOSSIBLE_MATCH; - - // declaring type - ReferenceBinding declaringType = constructor.declaringClass; - if (!constructor.isStatic() && !constructor.isPrivate()) { - level = this.matchLevelAsSubtype(declaringType, this.declaringSimpleName, this.declaringQualification); - } else { - level = this.matchLevelForType(this.declaringSimpleName, this.declaringQualification, declaringType); - } - if (level == IMPOSSIBLE_MATCH) { - return IMPOSSIBLE_MATCH; - } - - // parameter types - int parameterCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; - if (parameterCount > -1) { - int argumentCount = constructor.parameters == null ? 0 : constructor.parameters.length; - if (parameterCount != argumentCount) - return IMPOSSIBLE_MATCH; - for (int i = 0; i < parameterCount; i++) { - char[] qualification = this.parameterQualifications[i]; - char[] type = this.parameterSimpleNames[i]; - int newLevel = this.matchLevelForType(type, qualification, constructor.parameters[i]); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - return IMPOSSIBLE_MATCH; - case ACCURATE_MATCH: // keep previous level - break; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; - } - } - } - - return level; -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/ConstructorReferencePattern.java b/search/org/eclipse/jdt/internal/core/search/matching/ConstructorReferencePattern.java index 6c4e202..817f70f 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/ConstructorReferencePattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/ConstructorReferencePattern.java
@@ -58,6 +58,90 @@ isCaseSensitive); } /** + * Returns whether this constructor pattern matches the given allocation expression. + * Look at resolved information only if specified. + */ +private boolean matches(AllocationExpression allocation, boolean resolve) { + + // constructor name is simple type name + char[][] typeName = allocation.type.getTypeName(); + if (this.declaringSimpleName != null + && !this.matchesName(this.declaringSimpleName, typeName[typeName.length-1])) + return false; + + // declaring type + MethodBinding binding = allocation.binding; + if (resolve && binding != null) { + ReferenceBinding declaringBinding = binding.declaringClass; + if (!this.matchesType(this.declaringSimpleName, this.declaringQualification, declaringBinding)) + return false; + } + + // argument types + int argumentCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; + if (argumentCount > -1) { + int parameterCount = allocation.arguments == null ? 0 : allocation.arguments.length; + if (parameterCount != argumentCount) + return false; + + if (resolve && binding != null) { + for (int i = 0; i < parameterCount; i++) { + char[] qualification = this.parameterQualifications[i]; + char[] type = this.parameterSimpleNames[i]; + if (!this.matchesType(type, qualification, binding.parameters[i])) + return false; + } + } + } + + return true; +} +/** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + if (node instanceof AllocationExpression) { + return this.matches((AllocationExpression)node, resolve); + } else if (node instanceof ExplicitConstructorCall) { + return this.matches((ExplicitConstructorCall)node, resolve); + } + return false; +} +/** + * Returns whether this constructor pattern matches the given explicit constructor call. + * Look at resolved information only if specified. + */ +private boolean matches(ExplicitConstructorCall call, boolean resolve) { + // TBD: constructor name is super simple type name + + // declaring type + MethodBinding binding = call.binding; + if (resolve && binding != null) { + ReferenceBinding declaringBinding = binding.declaringClass; + if (!this.matchesType(this.declaringSimpleName, this.declaringQualification, declaringBinding)) + return false; + } + + // argument types + int argumentCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; + if (argumentCount > -1) { + int parameterCount = call.arguments == null ? 0 : call.arguments.length; + if (parameterCount != argumentCount) + return false; + + if (resolve && binding != null) { + for (int i = 0; i < parameterCount; i++) { + char[] qualification = this.parameterQualifications[i]; + char[] type = this.parameterSimpleNames[i]; + if (!this.matchesType(type, qualification, binding.parameters[i])) + return false; + } + } + } + + return true; +} +/** * @see SearchPattern#matchIndexEntry */ protected boolean matchIndexEntry() { @@ -89,141 +173,38 @@ public String toString(){ StringBuffer buffer = new StringBuffer(20); - buffer.append("ConstructorReferencePattern: "/*nonNLS*/); + buffer.append("ConstructorReferencePattern: "); if (declaringQualification != null) buffer.append(declaringQualification).append('.'); if (declaringSimpleName != null) buffer.append(declaringSimpleName); - else if (declaringQualification != null) buffer.append("*"/*nonNLS*/); + else if (declaringQualification != null) buffer.append("*"); buffer.append('('); if (parameterSimpleNames == null) { - buffer.append("..."/*nonNLS*/); + buffer.append("..."); } else { for (int i = 0, max = parameterSimpleNames.length; i < max; i++){ - if (i > 0) buffer.append(", "/*nonNLS*/); + if (i > 0) buffer.append(", "); if (parameterQualifications[i] != null) buffer.append(parameterQualifications[i]).append('.'); if (parameterSimpleNames[i] == null) buffer.append('*'); else buffer.append(parameterSimpleNames[i]); } } buffer.append(')'); - buffer.append(", "/*nonNLS*/); + buffer.append(", "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } - -/** - * Returns whether this constructor pattern matches the given allocation expression. - * Look at resolved information only if specified. - */ -private int matchLevel(AllocationExpression allocation, boolean resolve) { - - // constructor name is simple type name - char[][] typeName = allocation.type.getTypeName(); - if (this.declaringSimpleName != null - && !this.matchesName(this.declaringSimpleName, typeName[typeName.length-1])) - return IMPOSSIBLE_MATCH; - - if (resolve) { - return this.matchLevel(allocation.binding); - } else { - // argument types - int argumentCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; - if (argumentCount > -1) { - int parameterCount = allocation.arguments == null ? 0 : allocation.arguments.length; - if (parameterCount != argumentCount) - return IMPOSSIBLE_MATCH; - } - return POSSIBLE_MATCH; - } -} - -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - if (node instanceof AllocationExpression) { - return this.matchLevel((AllocationExpression)node, resolve); - } else if (node instanceof ExplicitConstructorCall) { - return this.matchLevel((ExplicitConstructorCall)node, resolve); - } - return IMPOSSIBLE_MATCH; -} - -/** - * Returns whether this constructor pattern matches the given explicit constructor call. - * Look at resolved information only if specified. - */ -private int matchLevel(ExplicitConstructorCall call, boolean resolve) { - // TBD: constructor name is super simple type name - - if (resolve) { - return this.matchLevel(call.binding); - } else { - // argument types - int argumentCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; - if (argumentCount > -1) { - int parameterCount = call.arguments == null ? 0 : call.arguments.length; - if (parameterCount != argumentCount) - return IMPOSSIBLE_MATCH; - } - return POSSIBLE_MATCH; - } -} - -/** - * @see SearchPattern#matchLevel(Binding binding). - */ -public int matchLevel(Binding binding) { - if (binding == null) return INACCURATE_MATCH; - if (!(binding instanceof MethodBinding)) return IMPOSSIBLE_MATCH; - int level; - - // declaring type - MethodBinding method = (MethodBinding)binding; - ReferenceBinding declaringBinding = method.declaringClass; - level = this.matchLevelForType(this.declaringSimpleName, this.declaringQualification, declaringBinding); - if (level == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH; - - // argument types - int argumentCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; - if (argumentCount > -1) { - if (method.parameters == null) { - level = INACCURATE_MATCH; - } else { - int parameterCount = method.parameters.length; - if (parameterCount != argumentCount) - return IMPOSSIBLE_MATCH; - - for (int i = 0; i < parameterCount; i++) { - char[] qualification = this.parameterQualifications[i]; - char[] type = this.parameterSimpleNames[i]; - int newLevel = this.matchLevelForType(type, qualification, method.parameters[i]); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - return IMPOSSIBLE_MATCH; - case ACCURATE_MATCH: // keep previous level - break; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; - } - } - } - } - - return level; -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/FieldDeclarationPattern.java b/search/org/eclipse/jdt/internal/core/search/matching/FieldDeclarationPattern.java index 53c1f67..5a35155 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/FieldDeclarationPattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/FieldDeclarationPattern.java
@@ -85,6 +85,71 @@ return CLASS; } /** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + if (!(node instanceof FieldDeclaration)) return false; + + FieldDeclaration field = (FieldDeclaration)node; + if (!field.isField()) return false; // ignore field initializers + + // field name + if (!this.matchesName(this.name, field.name)) + return false; + + // declaring type + FieldBinding binding = field.binding; + if (resolve && binding != null) { + ReferenceBinding declaringBinding = binding.declaringClass; + if (declaringBinding != null && !this.matchesType(this.declaringSimpleName, this.declaringQualification, declaringBinding)) + return false; + } + + // field type + if (this.typeQualification == null) { + TypeReference fieldType = field.type; + char[][] fieldTypeName = fieldType.getTypeName(); + char[] sourceName = this.toArrayName( + fieldTypeName[fieldTypeName.length-1], + fieldType.dimensions()); + if (!this.matchesName(this.typeSimpleName, sourceName)) + return false; + } else { + if (resolve + && binding != null + && !this.matchesType(this.typeSimpleName, this.typeQualification, binding.type)) + return false; + } + return true; +} +/** + * @see SearchPattern#matches(Binding) + */ +public boolean matches(Binding binding) { + if (!(binding instanceof FieldBinding)) return false; + + FieldBinding field = (FieldBinding)binding; + + // field name + if (!this.matchesName(this.name, field.readableName())) + return false; + + // declaring type + ReferenceBinding declaringBinding = field.declaringClass; + if (declaringBinding != null + && !this.matchesType(this.declaringSimpleName, this.declaringQualification, declaringBinding)) { + + return false; + } + + // field type + if(!this.matchesType(this.typeSimpleName, this.typeQualification, field.type)) { + return false; + } + + return true; +} +/** * @see SearchPattern#matchesBinary(Object, Object) */ public boolean matchesBinary(Object binaryInfo, Object enclosingBinaryInfo) { @@ -157,106 +222,38 @@ public String toString(){ StringBuffer buffer = new StringBuffer(20); - buffer.append("FieldDeclarationPattern: "/*nonNLS*/); + buffer.append("FieldDeclarationPattern: "); if (declaringQualification != null) buffer.append(declaringQualification).append('.'); if (declaringSimpleName != null) buffer.append(declaringSimpleName).append('.'); - else if (declaringQualification != null) buffer.append("*."/*nonNLS*/); + else if (declaringQualification != null) buffer.append("*."); if (name == null) { - buffer.append("*"/*nonNLS*/); + buffer.append("*"); } else { buffer.append(name); } if (typeQualification != null) - buffer.append(" --> "/*nonNLS*/).append(typeQualification).append('.'); - else if (typeSimpleName != null) buffer.append(" --> "/*nonNLS*/); + buffer.append(" --> ").append(typeQualification).append('.'); + else if (typeSimpleName != null) buffer.append(" --> "); if (typeSimpleName != null) buffer.append(typeSimpleName); - else if (typeQualification != null) buffer.append("*"/*nonNLS*/); - buffer.append(", "/*nonNLS*/); + else if (typeQualification != null) buffer.append("*"); + buffer.append(", "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } - -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - if (!(node instanceof FieldDeclaration)) return IMPOSSIBLE_MATCH; - - FieldDeclaration field = (FieldDeclaration)node; - - if (resolve) { - return this.matchLevel(field.binding); - } else { - if (!field.isField()) return IMPOSSIBLE_MATCH; // ignore field initializers - - // field name - if (!this.matchesName(this.name, field.name)) - return IMPOSSIBLE_MATCH; - - // field type - TypeReference fieldType = field.type; - char[][] fieldTypeName = fieldType.getTypeName(); - char[] sourceName = this.toArrayName( - fieldTypeName[fieldTypeName.length-1], - fieldType.dimensions()); - if (!this.matchesName(this.typeSimpleName, sourceName)) - return IMPOSSIBLE_MATCH; - - return POSSIBLE_MATCH; - } -} - -/** - * @see SearchPattern#matchLevel(Binding) - */ -public int matchLevel(Binding binding) { - if (binding == null) return INACCURATE_MATCH; - if (!(binding instanceof FieldBinding)) return IMPOSSIBLE_MATCH; - int level; - - FieldBinding field = (FieldBinding)binding; - - // field name - if (!this.matchesName(this.name, field.readableName())) - return IMPOSSIBLE_MATCH; - - // declaring type - ReferenceBinding declaringBinding = field.declaringClass; - if (declaringBinding == null ) { - return INACCURATE_MATCH; - } else { - level = this.matchLevelForType(this.declaringSimpleName, this.declaringQualification, declaringBinding); - if (level == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH; - } - - // field type - int newLevel = this.matchLevelForType(this.typeSimpleName, this.typeQualification, field.type); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - return IMPOSSIBLE_MATCH; - case ACCURATE_MATCH: // keep previous level - break; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; - } - - return level; -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/FieldReferencePattern.java b/search/org/eclipse/jdt/internal/core/search/matching/FieldReferencePattern.java index 92ec5e1..28dc7a6 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/FieldReferencePattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/FieldReferencePattern.java
@@ -112,6 +112,92 @@ return METHOD | FIELD; } /** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + if (node instanceof FieldReference) { + return this.matches((FieldReference)node, resolve); + } else if (node instanceof NameReference) { + return this.matches((NameReference)node, resolve); + } + return false; +} +/** + * Returns whether this field reference pattern matches the given field reference. + * Look at resolved information only if specified. + */ +private boolean matches(FieldReference fieldRef, boolean resolve) { + // field name + if (!this.matchesName(this.name, fieldRef.token)) + return false; + + if (resolve) { + // receiver type and field type + FieldBinding binding = fieldRef.binding; + if (binding != null && !this.matches(fieldRef.receiverType, fieldRef.isSuperAccess(), binding)) + return false; + } + + return true; +} +/** + * Returns whether this field reference pattern matches the given name reference. + * Look at resolved information only if specified. + */ +private boolean matches(NameReference nameRef, boolean resolve) { + // field name + boolean nameMatch = true; + if (this.name != null) { + if (nameRef instanceof SingleNameReference) { + nameMatch = matchesName(this.name, ((SingleNameReference)nameRef).token); + } else { // QualifiedNameReference + nameMatch = false; + QualifiedNameReference qNameRef = (QualifiedNameReference)nameRef; + char[][] tokens = qNameRef.tokens; + for (int i = qNameRef.indexOfFirstFieldBinding-1, max = tokens.length; i < max && !nameMatch; i++){ + if (i >= 0) nameMatch = matchesName(this.name, tokens[i]); + } + } + } + if (!nameMatch) return false; + + if (resolve){ + Binding binding = nameRef.binding; + if (binding != null){ + if (nameRef instanceof SingleNameReference){ + if (binding instanceof FieldBinding){ + if (!this.matches(nameRef.receiverType, false, (FieldBinding) binding)){ + return false; + } + } else { + return false; // must be a field binding + } + } else { // QualifiedNameReference + QualifiedNameReference qNameRef = (QualifiedNameReference)nameRef; + TypeBinding receiverType = qNameRef.receiverType; + FieldBinding fieldBinding = null; + if (!(binding instanceof FieldBinding + && matchesName(this.name, (fieldBinding = (FieldBinding)binding).name) + && matches(receiverType, false, fieldBinding))){ + if (binding instanceof VariableBinding){ + receiverType = ((VariableBinding) binding).type; + } + boolean otherMatch = false; + int otherMax = qNameRef.otherBindings == null ? 0 : qNameRef.otherBindings.length; + for (int i = 0; i < otherMax && !otherMatch; i++){ + FieldBinding otherBinding = qNameRef.otherBindings[i]; + if (otherBinding == null) break; + otherMatch = matchesName(this.name, otherBinding.name) && matches(receiverType, false, otherBinding); + receiverType = otherBinding.type; + } + if (!otherMatch) return false; + } + } + } + } + return true; +} +/** * @see SearchPattern#matchIndexEntry */ protected boolean matchIndexEntry() { @@ -138,6 +224,25 @@ return true; } /** + * Finds out whether the given ast node matches this search pattern. + * Returns IMPOSSIBLE_MATCH if it doesn't. + * Returns TRUSTED_MATCH if it matches exactly this search pattern (ie. + * it doesn't need to be resolved or it has already been resolved.) + * Returns POSSIBLE_MATCH if it potentially matches + * this search pattern and it needs to be resolved to get more information. + */ +public int matchLevel(AstNode node) { + if (this.matches(node, false)) { + if (this.needsResolve + || node instanceof NameReference) { // ensure it is a field + return POSSIBLE_MATCH; + } else { + return TRUSTED_MATCH; + } + } + return IMPOSSIBLE_MATCH; +} +/** * @see SearchPattern#matchReportReference */ protected void matchReportReference(AstNode reference, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { @@ -167,38 +272,38 @@ public String toString(){ StringBuffer buffer = new StringBuffer(20); - buffer.append("FieldReferencePattern: "/*nonNLS*/); + buffer.append("FieldReferencePattern: "); if (declaringQualification != null) buffer.append(declaringQualification).append('.'); if (declaringSimpleName != null) buffer.append(declaringSimpleName).append('.'); - else if (declaringQualification != null) buffer.append("*."/*nonNLS*/); + else if (declaringQualification != null) buffer.append("*."); if (name != null) { buffer.append(name); } else { - buffer.append("*"/*nonNLS*/); + buffer.append("*"); } if (typeQualification != null) - buffer.append(" --> "/*nonNLS*/).append(typeQualification).append('.'); - else if (typeSimpleName != null) buffer.append(" --> "/*nonNLS*/); + buffer.append(" --> ").append(typeQualification).append('.'); + else if (typeSimpleName != null) buffer.append(" --> "); if (typeSimpleName != null) buffer.append(typeSimpleName); - else if (typeQualification != null) buffer.append("*"/*nonNLS*/); - buffer.append(", "/*nonNLS*/); + else if (typeQualification != null) buffer.append("*"); + buffer.append(", "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } @@ -208,130 +313,24 @@ } /** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - if (node instanceof FieldReference) { - return this.matchLevel((FieldReference)node, resolve); - } else if (node instanceof NameReference) { - return this.matchLevel((NameReference)node, resolve); - } - return IMPOSSIBLE_MATCH; -} - -/** - * Returns whether this field reference pattern matches the given field reference. - * Look at resolved information only if specified. - */ -private int matchLevel(FieldReference fieldRef, boolean resolve) { - // field name - if (!this.matchesName(this.name, fieldRef.token)) - return IMPOSSIBLE_MATCH; - - if (resolve) { - // receiver type and field type - return this.matchLevel(fieldRef.receiverType, fieldRef.isSuperAccess(), fieldRef.binding); - } else { - return POSSIBLE_MATCH; - } -} - -/** - * Returns whether this field reference pattern matches the given name reference. - * Look at resolved information only if specified. - */ -private int matchLevel(NameReference nameRef, boolean resolve) { - // field name - boolean nameMatch = true; - if (this.name != null) { - if (nameRef instanceof SingleNameReference) { - nameMatch = this.matchesName(this.name, ((SingleNameReference)nameRef).token); - } else { // QualifiedNameReference - nameMatch = false; - QualifiedNameReference qNameRef = (QualifiedNameReference)nameRef; - char[][] tokens = qNameRef.tokens; - for (int i = qNameRef.indexOfFirstFieldBinding-1, max = tokens.length; i < max && !nameMatch; i++){ - if (i >= 0) nameMatch = this.matchesName(this.name, tokens[i]); - } - } - } - if (!nameMatch) return IMPOSSIBLE_MATCH; - - if (resolve) { - Binding binding = nameRef.binding; - if (binding == null) { - return INACCURATE_MATCH; - } else { - if (nameRef instanceof SingleNameReference){ - if (binding instanceof FieldBinding){ - return this.matchLevel(nameRef.receiverType, false, (FieldBinding) binding); - } else { - return IMPOSSIBLE_MATCH; // must be a field binding - } - } else { // QualifiedNameReference - QualifiedNameReference qNameRef = (QualifiedNameReference)nameRef; - TypeBinding receiverType = qNameRef.receiverType; - FieldBinding fieldBinding = null; - if (binding instanceof FieldBinding && this.matchesName(this.name, (fieldBinding = (FieldBinding)binding).name)) { - return this.matchLevel(receiverType, false, fieldBinding); - } else { - if (binding instanceof VariableBinding){ - receiverType = ((VariableBinding) binding).type; - } - int otherLevel = IMPOSSIBLE_MATCH; - int otherMax = qNameRef.otherBindings == null ? 0 : qNameRef.otherBindings.length; - for (int i = 0; i < otherMax && (otherLevel == IMPOSSIBLE_MATCH); i++){ - FieldBinding otherBinding = qNameRef.otherBindings[i]; - if (this.matchesName(this.name, otherBinding.name)) { - otherLevel = this.matchLevel(receiverType, false, otherBinding); - } - receiverType = otherBinding.type; - } - return otherLevel; - } - } - } - } else { - return POSSIBLE_MATCH; - } -} - -/** * Returns whether this field reference pattern matches the given field binding and receiver type. */ -private int matchLevel(TypeBinding receiverType, boolean isSuperAccess, FieldBinding binding) { - if (receiverType == null || binding == null) return INACCURATE_MATCH; - int level; - +private boolean matches(TypeBinding receiverType, boolean isSuperAccess, FieldBinding binding) { // receiver type ReferenceBinding receiverBinding = isSuperAccess || binding.isStatic() ? binding.declaringClass : (ReferenceBinding)receiverType; - if (receiverBinding == null) { - return INACCURATE_MATCH; - } else { - level = this.matchLevelAsSubtype(receiverBinding, this.declaringSimpleName, this.declaringQualification); - if (level == IMPOSSIBLE_MATCH) { - level = this.matchLevelForType(this.allSuperDeclaringTypeNames, receiverBinding); - if (level == IMPOSSIBLE_MATCH) { - return IMPOSSIBLE_MATCH; - } - } + if (receiverBinding != null + && !this.matchesAsSubtype(receiverBinding, this.declaringSimpleName, this.declaringQualification) + && !this.matchesType(this.allSuperDeclaringTypeNames, receiverBinding)) { + return false; } // field type - int newLevel = this.matchLevelForType(this.typeSimpleName, this.typeQualification, binding.type); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - return IMPOSSIBLE_MATCH; - case ACCURATE_MATCH: // keep previous level - break; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; - } + if (!this.matchesType(this.typeSimpleName, this.typeQualification, binding.type)) + return false; - return level; + return true; } }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java index 02acfbb..359681a 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java
@@ -41,7 +41,6 @@ import org.eclipse.jdt.core.search.IJavaSearchResultCollector; import org.eclipse.jdt.core.search.IJavaSearchScope; -import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; /** * Locate matches in compilation units. @@ -52,13 +51,10 @@ public IJavaSearchResultCollector collector; public IJavaSearchScope scope; - public MatchLocatorParser parser; - public LookupEnvironment lookupEnvironment; - public HashtableOfObject parsedUnits; - private PotentialMatch[] potentialMatches; - private int potentialMatchesIndex; - private int potentialMatchesLength; - + private MatchLocatorParser parser; + private LookupEnvironment lookupEnvironment; + private IResource currentResource; + private Openable currentOpenable; public MatchLocator( SearchPattern pattern, int detailLevel, @@ -91,48 +87,13 @@ */ public void accept(ISourceType sourceType, PackageBinding packageBinding) { while (sourceType.getEnclosingType() != null) sourceType = sourceType.getEnclosingType(); - CompilationUnitDeclaration unit; - if (sourceType instanceof SourceTypeElementInfo) { - // get source - SourceTypeElementInfo elementInfo = (SourceTypeElementInfo)sourceType; - IType type = elementInfo.getHandle(); - try { - final IFile file = (IFile)type.getUnderlyingResource(); - final char[] source = PotentialMatch.getContents(file); - - // get main type name - final String fileName = file.getFullPath().lastSegment(); - final char[] mainTypeName = fileName.substring(0, fileName.length()-5).toCharArray(); - - // source unit - ICompilationUnit sourceUnit = new ICompilationUnit() { - public char[] getContents() { - return source; - } - public char[] getFileName() { - return fileName.toCharArray(); - } - public char[] getMainTypeName() { - return mainTypeName; - } - }; - - // diet parse - CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0); - unit = this.parser.dietParse(sourceUnit, compilationResult); - } catch (JavaModelException e) { - unit = null; - } - } else { - CompilationResult result = new CompilationResult(sourceType.getFileName(), 0, 0); - unit = - SourceTypeConverter.buildCompilationUnit(sourceType, true, true, lookupEnvironment.problemReporter, result); - } + CompilationResult result = new CompilationResult(sourceType.getFileName(), 1, 1); // need to hold onto this + CompilationUnitDeclaration unit = + SourceTypeConverter.buildCompilationUnit(sourceType, true, true, lookupEnvironment.problemReporter, result); if (unit != null) { this.lookupEnvironment.buildTypeBindings(unit); this.lookupEnvironment.completeTypeBindings(unit, true); - this.parsedUnits.put(sourceType.getQualifiedName(), unit); } } /** @@ -148,9 +109,9 @@ private IImportDeclaration createImportHandle(ImportReference importRef) { char[] importName = CharOperation.concatWith(importRef.getImportName(), '.'); if (importRef.onDemand) { - importName = CharOperation.concat(importName, ".*"/*nonNLS*/.toCharArray()); + importName = CharOperation.concat(importName, ".*".toCharArray()); } - return ((CompilationUnit)this.getCurrentOpenable()).getImport( + return ((CompilationUnit)this.currentOpenable).getImport( new String(importName)); } /** @@ -186,7 +147,7 @@ TypeReference parameterType = arguments[i].type; char[] typeName = CharOperation.concatWith(parameterType.getTypeName(), '.'); for (int j = 0; j < parameterType.dimensions(); j++) { - typeName = CharOperation.concat(typeName, "[]"/*nonNLS*/.toCharArray()); + typeName = CharOperation.concat(typeName, "[]".toCharArray()); } parameterTypeSignatures[i] = Signature.createTypeSignature(typeName, false); } @@ -199,7 +160,7 @@ */ private IType createTypeHandle(char[][] simpleTypeNames) { // creates compilation unit - CompilationUnit unit = (CompilationUnit) this.getCurrentOpenable(); + CompilationUnit unit = (CompilationUnit) this.currentOpenable; // create type int length = simpleTypeNames.length; @@ -209,8 +170,36 @@ } return type; } +private char[] getContents(IFile file) { + BufferedInputStream input = null; + try { + input = new BufferedInputStream(file.getContents(true)); + StringBuffer buffer= new StringBuffer(); + int nextChar = input.read(); + while (nextChar != -1) { + buffer.append( (char)nextChar ); + nextChar = input.read(); + } + int length = buffer.length(); + char[] result = new char[length]; + buffer.getChars(0, length, result, 0); + return result; + } catch (IOException e) { + return null; + } catch (CoreException e) { + return null; + } finally { + if (input != null) { + try { + input.close(); + } catch (IOException e) { + // nothing can be done if the file cannot be closed + } + } + } +} protected IResource getCurrentResource() { - return this.potentialMatches[this.potentialMatchesIndex].resource; + return this.currentResource; } protected Scanner getScanner() { return this.parser == null ? null : this.parser.scanner; @@ -228,47 +217,50 @@ double totalWork = 0; int lastProgress = 0; boolean couldInitializePattern = false; - this.potentialMatches = new PotentialMatch[10]; - this.potentialMatchesLength = 0; for (int i = 0; i < length; i++) { IProgressMonitor monitor = this.collector.getProgressMonitor(); if (monitor != null && monitor.isCanceled()) { throw new OperationCanceledException(); } String pathString = filePaths[i]; - Openable openable = factory.createOpenable(pathString); - if (openable == null) - continue; // match is outside classpath + this.currentOpenable = factory.createOpenable(pathString); + if (this.currentOpenable == null) continue; // match is outside classpath // create new parser and lookup environment if this is a new project - IResource resource = null; try { - JavaProject javaProject = (JavaProject)openable.getJavaProject(); - resource = openable.getUnderlyingResource(); - if (resource == null) { // case of a file in an external jar - resource = javaProject.getProject(); + JavaProject javaProject = (JavaProject)this.currentOpenable.getJavaProject(); + this.currentResource = this.currentOpenable.getUnderlyingResource(); + if (this.currentResource == null) { // case of a file in an external jar + this.currentResource = javaProject.getProject(); } if (!javaProject.equals(previousJavaProject)) { - // locate matches in previous project - if (previousJavaProject != null) { - this.locateMatches(); - this.potentialMatchesLength = 0; - } - // create parser for this project couldInitializePattern = this.createParser(javaProject); previousJavaProject = javaProject; } - if (!couldInitializePattern) - continue; // the pattern could not be initialized: the match cannot be in this project + if (!couldInitializePattern) continue; // the pattern could not be initialized: the match cannot be in this project } catch (JavaModelException e) { // file doesn't exist -> skip it continue; } - // add potential match - this.addPotentialMatch(resource, openable); - + // locate matches in current file and report them + try { + if (this.currentOpenable instanceof CompilationUnit) { + this.locateMatchesInCompilationUnit(); + } else if (this.currentOpenable instanceof org.eclipse.jdt.internal.core.ClassFile) { + this.locateMatchesInClassFile(); + } + } catch (AbortCompilation e) { + // problem with class path: it could not find base classes + throw new JavaModelException(e, IJavaModelStatusConstants.BUILDER_INITIALIZATION_ERROR); + } catch (CoreException e) { + if (e instanceof JavaModelException) { + throw (JavaModelException)e; + } else { + throw new JavaModelException(e); + } + } if (monitor != null) { totalWork = totalWork + increment; int worked = (int)totalWork - lastProgress; @@ -276,13 +268,207 @@ lastProgress = (int)totalWork; } } - - // last project - if (previousJavaProject != null) { - this.locateMatches(); - this.potentialMatchesLength = 0; +} +/** + * Locate declaration in the current class file. This class file is always in a jar. + */ +private void locateMatchesInClassFile() throws CoreException, JavaModelException { + org.eclipse.jdt.internal.core.ClassFile classFile = (org.eclipse.jdt.internal.core.ClassFile)this.currentOpenable; + BinaryType binaryType = (BinaryType)classFile.getType(); + IBinaryType info; + if (classFile.isOpen()) { + // reuse the info from the java model cache + info = (IBinaryType)binaryType.getRawInfo(); + } else { + // create a temporary info + try { + IJavaElement pkg = classFile.getParent(); + PackageFragmentRoot root = (PackageFragmentRoot)pkg.getParent(); + if (root.isArchive()) { + // class file in a jar + String pkgPath = pkg.getElementName().replace('.', '/'); + String classFilePath = + (pkgPath.length() > 0) ? + pkgPath + "/" + classFile.getElementName() : + classFile.getElementName(); + ZipFile zipFile = null; + try { + zipFile = ((JarPackageFragmentRoot)root).getJar(); + info = org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.read( + zipFile, + classFilePath); + } finally { + if (zipFile != null) { + try { + zipFile.close(); + } catch (IOException e) { + // ignore + } + } + } + } else { + // class file in a directory + String osPath = this.currentResource.getFullPath().toOSString(); + info = org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.read(osPath); + } + } catch (org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException e) { + e.printStackTrace(); + return; + } catch (java.io.IOException e) { + throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION); + } + } + // check class definition + if (this.pattern.matchesBinary(info, null)) { + this.reportBinaryMatch(binaryType, info, IJavaSearchResultCollector.EXACT_MATCH); + } + + boolean compilationAborted = false; + if (this.pattern.needsResolve) { + // resolve + BinaryTypeBinding binding = null; + try { + binding = this.lookupEnvironment.cacheBinaryType(info); + if (binding == null) { // it was already cached as a result of a previous query + char[][] compoundName = CharOperation.splitOn('.', binaryType.getFullyQualifiedName().toCharArray()); + ReferenceBinding referenceBinding = this.lookupEnvironment.getCachedType(compoundName); + if (referenceBinding != null && (referenceBinding instanceof BinaryTypeBinding)) { + // if the binding could be found and if it comes from a source type, + binding = (BinaryTypeBinding)referenceBinding; + } + } + + // check methods + if (binding != null) { + MethodBinding[] methods = binding.methods(); + for (int i = 0; i < methods.length; i++) { + MethodBinding method = methods[i]; + if (this.pattern.matches(method)) { + IMethod methodHandle = + binaryType.getMethod( + new String(method.isConstructor() ? binding.compoundName[binding.compoundName.length-1] : method.selector), + Signature.getParameterTypes(new String(method.signature()).replace('/', '.')) + ); + this.reportBinaryMatch(methodHandle, info, IJavaSearchResultCollector.EXACT_MATCH); + } + } + } + + // check fields + if (binding != null) { + FieldBinding[] fields = binding.fields(); + for (int i = 0; i < fields.length; i++) { + FieldBinding field = fields[i]; + if (this.pattern.matches(field)) { + IField fieldHandle = binaryType.getField(new String(field.name)); + this.reportBinaryMatch(fieldHandle, info, IJavaSearchResultCollector.EXACT_MATCH); + } + } + } + } catch (AbortCompilation e) { + binding = null; + } + + // no need to check binary info if resolve was successful + compilationAborted = binding == null; + if (!compilationAborted) return; + } + + // if compilation was aborted it is a problem with the class path: + // report as a potential match if binary info matches the pattern + int accuracy = compilationAborted ? IJavaSearchResultCollector.POTENTIAL_MATCH : IJavaSearchResultCollector.EXACT_MATCH; + + // check methods + IBinaryMethod[] methods = info.getMethods(); + int length = methods == null ? 0 : methods.length; + for (int i = 0; i < length; i++) { + IBinaryMethod method = methods[i]; + if (this.pattern.matchesBinary(method, info)) { + IMethod methodHandle = + binaryType.getMethod( + new String(method.isConstructor() ? info.getName() : method.getSelector()), + Signature.getParameterTypes(new String(method.getMethodDescriptor()).replace('/', '.')) + ); + this.reportBinaryMatch(methodHandle, info, accuracy); + } + } + + // check fields + IBinaryField[] fields = info.getFields(); + length = fields == null ? 0 : fields.length; + for (int i = 0; i < length; i++) { + IBinaryField field = fields[i]; + if (this.pattern.matchesBinary(field, info)) { + IField fieldHandle = binaryType.getField(new String(field.getName())); + this.reportBinaryMatch(fieldHandle, info, accuracy); + } + } +} +private void locateMatchesInCompilationUnit() throws CoreException { + // get source + final char[] source = getContents((IFile)this.currentResource); + + // get main type name + String pathString = this.currentResource.toString(); + int lastDot = pathString.lastIndexOf('/'); + // remove folder path and extension ".java" + final char[] mainTypeName = pathString.substring(lastDot+1, pathString.length()-5).toCharArray(); + + // parse + ICompilationUnit sourceUnit = new ICompilationUnit() { + public char[] getContents() { + return source; + } + public char[] getFileName() { + return MatchLocator.this.currentResource.getName().toCharArray(); + } + public char[] getMainTypeName() { + return mainTypeName; + } + }; + MatchSet set = new MatchSet(this); + this.parser.matchSet = set; + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0); + CompilationUnitDeclaration parsedUnit = this.parser.parse(sourceUnit, compilationResult); + + if (parsedUnit != null) { + // report matches that don't need resolve + set.cuHasBeenResolved = false; + set.accuracy = IJavaSearchResultCollector.EXACT_MATCH; + set.reportMatching(parsedUnit); + + // resolve if needed + if (set.needsResolve()) { + if (parsedUnit.types != null) { + /** + * First approximation: reset the lookup environment -> this will recreate the bindings for the current CU + * Optimization: the binding resolution should be done for all compilation units at once + */ + this.lookupEnvironment.reset(); + + try { + lookupEnvironment.buildTypeBindings(parsedUnit); + if (parsedUnit.scope != null) { + lookupEnvironment.completeTypeBindings(parsedUnit, true); + parsedUnit.scope.faultInTypes(); + parsedUnit.resolve(); + //this.pattern.initializeFromLookupEnvironment(this.lookupEnvironment); + } + // report matches that needed resolve + set.cuHasBeenResolved = true; + set.accuracy = IJavaSearchResultCollector.EXACT_MATCH; + set.reportMatching(parsedUnit); + } catch (AbortCompilation e) { + // could not resolve (reasons include "could not find library class") -> ignore and report the unresolved nodes + set.cuHasBeenResolved = false; + set.accuracy = IJavaSearchResultCollector.POTENTIAL_MATCH; + set.reportMatching(parsedUnit); + } + } + } + } } /** * Locates the package declarations corresponding to this locator's pattern. @@ -310,14 +496,10 @@ for (int k = 0, pksLength = pkgs.length; k < pksLength; k++) { IJavaElement pkg = pkgs[k]; if (pkgPattern.matchesName(pkgPattern.pkgName, pkg.getElementName().toCharArray())) { - IResource resource = pkg.getUnderlyingResource(); - if (resource == null) { // case of a file in an external jar - resource = javaProject.getProject(); + this.currentResource = pkg.getUnderlyingResource(); + if (this.currentResource == null) { // case of a file in an external jar + this.currentResource = javaProject.getProject(); } - this.potentialMatchesIndex = 0; - this.potentialMatches = new PotentialMatch[] { - new PotentialMatch(this, resource, null) - }; try { this.report(-1, -2, pkg, IJavaSearchResultCollector.EXACT_MATCH); } catch (CoreException e) { @@ -336,7 +518,7 @@ public void report(int sourceStart, int sourceEnd, IJavaElement element, int accuracy) throws CoreException { if (this.scope.encloses(element)) { this.collector.accept( - this.getCurrentResource(), + this.currentResource, sourceStart, sourceEnd + 1, element, @@ -344,7 +526,7 @@ ); } } -public void reportBinaryMatch(IMember binaryMember, IBinaryType info, int accuracy) throws CoreException, JavaModelException { +private void reportBinaryMatch(IMember binaryMember, IBinaryType info, int accuracy) throws CoreException, JavaModelException { ISourceRange range = binaryMember.getNameRange(); if (range.getOffset() == -1) { ClassFile classFile = (ClassFile)binaryMember.getClassFile(); @@ -403,7 +585,6 @@ // compute source positions of the selector Scanner scanner = parser.scanner; int nameSourceStart = methodDeclaration.sourceStart; - scanner.setSourceBuffer(this.potentialMatches[this.potentialMatchesIndex].getSource()); scanner.resetTo(nameSourceStart, methodDeclaration.sourceEnd); try { scanner.getNextToken(); @@ -438,7 +619,6 @@ // compute source positions of the qualified reference Scanner scanner = parser.scanner; - scanner.setSourceBuffer(this.potentialMatches[this.potentialMatchesIndex].getSource()); scanner.resetTo(sourceStart, sourceEnd); int refSourceStart = -1, refSourceEnd = -1; @@ -476,7 +656,7 @@ } } while (token != TerminalSymbols.TokenNameEOF && i < tokenNumber); - // accept reference + // accept method declaration if (refSourceStart != -1) { this.report(refSourceStart, refSourceEnd, element, accuracy); } else { @@ -575,18 +755,6 @@ this.report(typeDeclaration.sourceStart, typeDeclaration.sourceEnd, type, accuracy); } -private void addPotentialMatch(IResource resource, Openable openable) throws JavaModelException { - try { - if (this.potentialMatchesLength == this.potentialMatches.length) { - System.arraycopy(this.potentialMatches, 0, this.potentialMatches = new PotentialMatch[this.potentialMatchesLength*2], 0, this.potentialMatchesLength); - } - this.potentialMatches[this.potentialMatchesLength++] = new PotentialMatch(this, resource, openable); - } catch (AbortCompilation e) { - // problem with class path: it could not find base classes - throw new JavaModelException(e, IJavaModelStatusConstants.BUILDER_INITIALIZATION_ERROR); - } -} - /** * Create a new parser for the given project, as well as a lookup environment. * Asks the pattern to initialize itself from the lookup environment. @@ -604,37 +772,6 @@ problemFactory); this.lookupEnvironment = new LookupEnvironment(this, options, problemReporter, nameEnvironment); this.parser = new MatchLocatorParser(problemReporter); - this.parsedUnits = new HashtableOfObject(10); return this.pattern.initializeFromLookupEnvironment(this.lookupEnvironment); } - -protected Openable getCurrentOpenable() { - return this.potentialMatches[this.potentialMatchesIndex].openable; -} - -/** - * Locate the matches amongst the potential matches. - */ -private void locateMatches() throws JavaModelException { - // binding resolution - this.lookupEnvironment.completeTypeBindings(); - - // potential match resolution - for (this.potentialMatchesIndex = 0; this.potentialMatchesIndex < this.potentialMatchesLength; this.potentialMatchesIndex++) { - try { - PotentialMatch potentialMatch = this.potentialMatches[this.potentialMatchesIndex]; - potentialMatch.locateMatches(); - potentialMatch.reset(); - } catch (AbortCompilation e) { - // problem with class path: it could not find base classes - throw new JavaModelException(e, IJavaModelStatusConstants.BUILDER_INITIALIZATION_ERROR); - } catch (CoreException e) { - if (e instanceof JavaModelException) { - throw (JavaModelException)e; - } else { - throw new JavaModelException(e); - } - } - } -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java b/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java index 2c8d886..4370011 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java
@@ -24,77 +24,70 @@ } protected void classInstanceCreation(boolean alwaysQualified) { super.classInstanceCreation(alwaysQualified); - if (this.matchSet != null) { - this.matchSet.checkMatching(this.expressionStack[this.expressionPtr]); - } + this.matchSet.checkMatching(this.expressionStack[this.expressionPtr]); } protected void consumeExplicitConstructorInvocation(int flag, int recFlag) { super.consumeExplicitConstructorInvocation(flag, recFlag); - if (this.matchSet != null) { - this.matchSet.checkMatching(this.astStack[this.astPtr]); - } + this.matchSet.checkMatching(this.astStack[this.astPtr]); } protected void consumeFieldAccess(boolean isSuperAccess) { super.consumeFieldAccess(isSuperAccess); - if (this.matchSet != null) { - this.matchSet.checkMatching(this.expressionStack[this.expressionPtr]); - } + this.matchSet.checkMatching(this.expressionStack[this.expressionPtr]); } protected void consumeMethodInvocationName() { super.consumeMethodInvocationName(); - if (this.matchSet != null) { - this.matchSet.checkMatching(this.expressionStack[this.expressionPtr]); - } + this.matchSet.checkMatching(this.expressionStack[this.expressionPtr]); } protected void consumeMethodInvocationPrimary() { super.consumeMethodInvocationPrimary(); - if (this.matchSet != null) { - this.matchSet.checkMatching(this.expressionStack[this.expressionPtr]); - } + this.matchSet.checkMatching(this.expressionStack[this.expressionPtr]); } protected void consumeMethodInvocationSuper() { super.consumeMethodInvocationSuper(); - if (this.matchSet != null) { - this.matchSet.checkMatching(this.expressionStack[this.expressionPtr]); - } + this.matchSet.checkMatching(this.expressionStack[this.expressionPtr]); } protected void consumeSingleTypeImportDeclarationName() { super.consumeSingleTypeImportDeclarationName(); - if (this.matchSet != null) { - this.matchSet.checkMatching(this.astStack[this.astPtr]); - } + this.matchSet.checkMatching(this.astStack[this.astPtr]); } protected void consumeTypeImportOnDemandDeclarationName() { super.consumeTypeImportOnDemandDeclarationName(); - if (this.matchSet != null) { - this.matchSet.checkMatching(this.astStack[this.astPtr]); - } + this.matchSet.checkMatching(this.astStack[this.astPtr]); } protected TypeReference getTypeReference(int dim) { TypeReference typeRef = super.getTypeReference(dim); - if (this.matchSet != null) { - this.matchSet.checkMatching(typeRef); // NB: Don't check container since type reference can happen anywhere - } + this.matchSet.checkMatching(typeRef); // NB: Don't check container since type reference can happen anywhere return typeRef; } protected NameReference getUnspecifiedReference() { NameReference nameRef = super.getUnspecifiedReference(); - if (this.matchSet != null) { - this.matchSet.checkMatching(nameRef); // NB: Don't check container since unspecified reference can happen anywhere - } + this.matchSet.checkMatching(nameRef); // NB: Don't check container since unspecified reference can happen anywhere return nameRef; } protected NameReference getUnspecifiedReferenceOptimized() { NameReference nameRef = super.getUnspecifiedReferenceOptimized(); - if (this.matchSet != null) { - this.matchSet.checkMatching(nameRef); // NB: Don't check container since unspecified reference can happen anywhere - } + this.matchSet.checkMatching(nameRef); // NB: Don't check container since unspecified reference can happen anywhere return nameRef; } /** + * Parses the given source unit in 2 times: + * - first do a diet parse to determine the structure of the compilation unit + * - then do a method body parse of each method to determine the references + */ +public CompilationUnitDeclaration parse( + ICompilationUnit sourceUnit, + CompilationResult compilationResult) { + + this.diet = true; + CompilationUnitDeclaration unit = super.parse(sourceUnit, compilationResult); + this.diet = false; + this.parseBodies(unit); + return unit; +} +/** * Parses the method bodies in the given compilation unit */ -public void parseBodies(CompilationUnitDeclaration unit) { +private void parseBodies(CompilationUnitDeclaration unit) { TypeDeclaration[] types = unit.types; if (types != null) { for (int i = 0; i < types.length; i++) {
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/MatchSet.java b/search/org/eclipse/jdt/internal/core/search/matching/MatchSet.java index 1e56167..b65a9e9 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/MatchSet.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/MatchSet.java
@@ -42,18 +42,18 @@ this.matchContainer = locator.pattern.matchContainer(); } public void addPossibleMatch(AstNode node) { - this.potentialMatchingNodes.put(node, new Integer(SearchPattern.POSSIBLE_MATCH)); + this.potentialMatchingNodes.put(node, node); } public void addTrustedMatch(AstNode node) { - this.matchingNodes.put(node, new Integer(SearchPattern.ACCURATE_MATCH)); + this.matchingNodes.put(node, node); } public void checkMatching(AstNode node) { - int matchLevel = this.locator.pattern.matchLevel(node, false); + int matchLevel = this.locator.pattern.matchLevel(node); switch (matchLevel) { case SearchPattern.POSSIBLE_MATCH: this.addPossibleMatch(node); break; - case SearchPattern.ACCURATE_MATCH: + case SearchPattern.TRUSTED_MATCH: this.addTrustedMatch(node); } } @@ -109,15 +109,9 @@ AstNode[] nodes = this.matchingNodes(method.declarationSourceStart, method.declarationSourceEnd); for (int i = 0; i < nodes.length; i++) { AstNode node = nodes[i]; - Integer level = (Integer)this.matchingNodes.remove(node); + this.matchingNodes.remove(node); if ((this.matchContainer & SearchPattern.METHOD) != 0) { - this.locator.reportReference( - node, - method, - definingTypeNames, - level.intValue() == SearchPattern.ACCURATE_MATCH ? - IJavaSearchResultCollector.EXACT_MATCH : - IJavaSearchResultCollector.POTENTIAL_MATCH); + this.locator.reportReference(node, method, definingTypeNames, this.accuracy); } } if (this.potentialMatchingNodes(method.declarationSourceStart, method.declarationSourceEnd).length == 0) { @@ -134,9 +128,8 @@ // move the potential matching nodes that exactly match the search pattern to the matching nodes set for (Enumeration potentialMatches = this.potentialMatchingNodes.keys(); potentialMatches.hasMoreElements();) { AstNode node = (AstNode) potentialMatches.nextElement(); - int level = this.locator.pattern.matchLevel(node, true); - if (level == SearchPattern.ACCURATE_MATCH || level == SearchPattern.INACCURATE_MATCH) { - this.matchingNodes.put(node, new Integer(level)); + if (this.locator.pattern.matches(node)) { + this.matchingNodes.put(node, node); } } this.potentialMatchingNodes = new Hashtable(); @@ -144,8 +137,8 @@ // package declaration ImportReference pkg = unit.currentPackage; - Integer level; - if (pkg != null && (level = (Integer)this.matchingNodes.remove(pkg)) != null) { + if (pkg != null && this.matchingNodes.get(pkg) == pkg) { + this.matchingNodes.remove(pkg); if ((this.matchContainer & SearchPattern.COMPILATION_UNIT) != 0) { this.locator.reportPackageDeclaration(pkg); } @@ -156,13 +149,10 @@ if (imports != null) { for (int i = 0; i < imports.length; i++) { ImportReference importRef = imports[i]; - if ((level = (Integer)this.matchingNodes.remove(importRef)) != null) { + if (this.matchingNodes.get(importRef) == importRef) { + this.matchingNodes.remove(importRef); if ((this.matchContainer & SearchPattern.COMPILATION_UNIT) != 0) { - this.locator.reportImport( - importRef, - level.intValue() == SearchPattern.ACCURATE_MATCH ? - IJavaSearchResultCollector.EXACT_MATCH : - IJavaSearchResultCollector.POTENTIAL_MATCH); + this.locator.reportImport(importRef, this.accuracy); } } } @@ -173,14 +163,10 @@ if (types != null) { for (int i = 0; i < types.length; i++) { TypeDeclaration type = types[i]; - if ((level = (Integer)this.matchingNodes.remove(type)) != null) { + if (this.matchingNodes.get(type) == type) { + this.matchingNodes.remove(type); if ((this.matchContainer & SearchPattern.COMPILATION_UNIT) != 0) { - this.locator.reportTypeDeclaration( - type, - new char[][] {type.name}, - level.intValue() == SearchPattern.ACCURATE_MATCH ? - IJavaSearchResultCollector.EXACT_MATCH : - IJavaSearchResultCollector.POTENTIAL_MATCH); + this.locator.reportTypeDeclaration(type, new char[][] {type.name}, this.accuracy); } } this.reportMatching(type, EMPTY_CHAR_CHAR); @@ -196,16 +182,9 @@ AstNode[] nodes = this.matchingNodes(field.declarationSourceStart, field.declarationSourceEnd); for (int i = 0; i < nodes.length; i++) { AstNode node = nodes[i]; - Integer level = (Integer)this.matchingNodes.remove(node); + this.matchingNodes.remove(node); if ((this.matchContainer & SearchPattern.FIELD) != 0) { - this.locator.reportReference( - node, - type, - field, - definingTypeNames, - level.intValue() == SearchPattern.ACCURATE_MATCH ? - IJavaSearchResultCollector.EXACT_MATCH : - IJavaSearchResultCollector.POTENTIAL_MATCH); + this.locator.reportReference(node, type, field, definingTypeNames, this.accuracy); } } } @@ -216,21 +195,16 @@ */ private void reportMatching(TypeDeclaration type, char[][] enclosingTypeNames) throws CoreException { char[][] definingTypeNames = CharOperation.arrayConcat(enclosingTypeNames, type.name); - Integer level; // fields FieldDeclaration[] fields = type.fields; if (fields != null) { for (int i = 0; i < fields.length; i++) { FieldDeclaration field = fields[i]; - if ((level = (Integer)this.matchingNodes.remove(field)) != null) { + if (this.matchingNodes.get(field) == field) { + this.matchingNodes.remove(field); if ((this.matchContainer & SearchPattern.CLASS) != 0) { - this.locator.reportFieldDeclaration( - field, - definingTypeNames, - level.intValue() == SearchPattern.ACCURATE_MATCH ? - IJavaSearchResultCollector.EXACT_MATCH : - IJavaSearchResultCollector.POTENTIAL_MATCH); + this.locator.reportFieldDeclaration(field, definingTypeNames, this.accuracy); } } this.reportMatching(field, definingTypeNames, type); @@ -242,14 +216,10 @@ if (methods != null) { for (int i = 0; i < methods.length; i++) { AbstractMethodDeclaration method = methods[i]; - if ((level = (Integer)this.matchingNodes.remove(method)) != null) { + if (this.matchingNodes.get(method) == method) { + this.matchingNodes.remove(method); if ((this.matchContainer & SearchPattern.CLASS) != 0) { - this.locator.reportMethodDeclaration( - method, - definingTypeNames, - level.intValue() == SearchPattern.ACCURATE_MATCH ? - IJavaSearchResultCollector.EXACT_MATCH : - IJavaSearchResultCollector.POTENTIAL_MATCH); + this.locator.reportMethodDeclaration(method, definingTypeNames, this.accuracy); } } this.reportMatching(method, definingTypeNames); @@ -261,15 +231,11 @@ if (memberTypes != null) { for (int i = 0; i < memberTypes.length; i++) { MemberTypeDeclaration memberType = memberTypes[i]; - if ((level = (Integer)this.matchingNodes.remove(memberType)) != null) { + if (this.matchingNodes.get(memberType) == memberType) { + this.matchingNodes.remove(memberType); if ((this.matchContainer & SearchPattern.CLASS) != 0) { char[][] memberTypeNames = CharOperation.arrayConcat(definingTypeNames, memberType.name); - this.locator.reportTypeDeclaration( - memberType, - memberTypeNames, - level.intValue() == SearchPattern.ACCURATE_MATCH ? - IJavaSearchResultCollector.EXACT_MATCH : - IJavaSearchResultCollector.POTENTIAL_MATCH); + this.locator.reportTypeDeclaration(memberType, memberTypeNames, this.accuracy); } } this.reportMatching(memberType, definingTypeNames); @@ -278,28 +244,20 @@ // super types TypeReference superClass = type.superclass; - if (superClass != null && (level = (Integer)this.matchingNodes.remove(superClass)) != null) { + if (superClass != null && this.matchingNodes.get(superClass) == superClass) { + this.matchingNodes.remove(superClass); if ((this.matchContainer & SearchPattern.CLASS) != 0) { - this.locator.reportSuperTypeReference( - superClass, - definingTypeNames, - level.intValue() == SearchPattern.ACCURATE_MATCH ? - IJavaSearchResultCollector.EXACT_MATCH : - IJavaSearchResultCollector.POTENTIAL_MATCH); + this.locator.reportSuperTypeReference(superClass, definingTypeNames, this.accuracy); } } TypeReference[] superInterfaces = type.superInterfaces; if (superInterfaces != null) { for (int i = 0; i < superInterfaces.length; i++) { TypeReference superInterface = superInterfaces[i]; - if ((level = (Integer)this.matchingNodes.get(superInterface)) != null) { + if (this.matchingNodes.get(superInterface) == superInterface) { + this.matchingNodes.remove(superInterface); if ((this.matchContainer & SearchPattern.CLASS) != 0) { - this.locator.reportSuperTypeReference( - superInterface, - definingTypeNames, - level.intValue() == SearchPattern.ACCURATE_MATCH ? - IJavaSearchResultCollector.EXACT_MATCH : - IJavaSearchResultCollector.POTENTIAL_MATCH); + this.locator.reportSuperTypeReference(superInterface, definingTypeNames, this.accuracy); } } } @@ -308,55 +266,17 @@ } public String toString() { StringBuffer result = new StringBuffer(); - result.append("Exact matches:"/*nonNLS*/); + result.append("Exact matches:"); for (Enumeration enum = this.matchingNodes.keys(); enum.hasMoreElements();) { - result.append("\n"/*nonNLS*/); + result.append("\n"); AstNode node = (AstNode)enum.nextElement(); - Object value = this.matchingNodes.get(node); - if (value instanceof Integer) { - result.append('\t'); - int accuracy = ((Integer)value).intValue(); - switch (accuracy) { - case SearchPattern.IMPOSSIBLE_MATCH: - result.append("IMPOSSIBLE_MATCH: "/*nonNLS*/); - break; - case SearchPattern.POSSIBLE_MATCH: - result.append("POSSIBLE_MATCH: "/*nonNLS*/); - break; - case SearchPattern.INACCURATE_MATCH: - result.append("INACCURATE_MATCH: "/*nonNLS*/); - break; - case SearchPattern.ACCURATE_MATCH: - result.append("ACCURATE_MATCH: "/*nonNLS*/); - break; - } - } - result.append(node.toString(0)); + result.append(node.toString(1)); } - result.append("\nPotential matches:"/*nonNLS*/); + result.append("\nPotential matches:"); for (Enumeration enum = this.potentialMatchingNodes.keys(); enum.hasMoreElements();) { - result.append("\n"/*nonNLS*/); + result.append("\n"); AstNode node = (AstNode)enum.nextElement(); - Object value = this.potentialMatchingNodes.get(node); - if (value instanceof Integer) { - result.append("\t"); - int accuracy = ((Integer)value).intValue(); - switch (accuracy) { - case SearchPattern.IMPOSSIBLE_MATCH: - result.append("IMPOSSIBLE_MATCH: "); - break; - case SearchPattern.POSSIBLE_MATCH: - result.append("POSSIBLE_MATCH: "); - break; - case SearchPattern.INACCURATE_MATCH: - result.append("INACCURATE_MATCH: "); - break; - case SearchPattern.ACCURATE_MATCH: - result.append("ACCURATE_MATCH: "); - break; - } - } - result.append(node.toString(0)); + result.append(node.toString(1)); } return result.toString(); }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java b/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java index e2dcc4b..06768d4 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java
@@ -70,7 +70,7 @@ } } public String getPatternName(){ - return "MethodDeclarationPattern: "/*nonNLS*/; + return "MethodDeclarationPattern: "; } /** * @see SearchPattern#indexEntryPrefix @@ -90,6 +90,117 @@ return CLASS; } /** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + if (!(node instanceof MethodDeclaration)) return false; + + MethodDeclaration method = (MethodDeclaration)node; + + // selector + if (!this.matchesName(this.selector, method.selector)) + return false; + + // declaring type + MethodBinding binding = method.binding; + if (resolve && binding != null) { + ReferenceBinding declaringType = binding.declaringClass; + if (declaringType != null) { + if (!binding.isStatic() && !binding.isPrivate()) { + if (!this.matchesAsSubtype(declaringType, this.declaringSimpleName, this.declaringQualification)) + return false; + } else { + if (!this.matchesType(this.declaringSimpleName, this.declaringQualification, declaringType)) + return false; + } + } + } + + // return type + if (this.returnQualification == null) { + if (this.returnSimpleName != null) { + TypeReference methodReturnType = method.returnType; + if (methodReturnType != null) { + char[][] methodReturnTypeName = methodReturnType.getTypeName(); + char[] sourceName = this.toArrayName( + methodReturnTypeName[methodReturnTypeName.length-1], + methodReturnType.dimensions()); + if (!this.matchesName(this.returnSimpleName, sourceName)) + return false; + } + } + } else { + if (resolve + && binding != null + && !this.matchesType(this.returnSimpleName, this.returnQualification, binding.returnType)) + return false; + } + + // parameter types + int parameterCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; + if (parameterCount > -1) { + int argumentCount = method.arguments == null ? 0 : method.arguments.length; + if (parameterCount != argumentCount) + return false; + + if (resolve && binding != null) { + for (int i = 0; i < parameterCount; i++) { + char[] qualification = this.parameterQualifications[i]; + char[] type = this.parameterSimpleNames[i]; + if (!this.matchesType(type, qualification, binding.parameters[i])) + return false; + } + } + } + + return true; +} +/** + * @see SearchPattern#matches(Binding) + */ +public boolean matches(Binding binding) { + if (!(binding instanceof MethodBinding)) return false; + + MethodBinding method = (MethodBinding)binding; + + // selector + if (!this.matchesName(this.selector, method.selector)) + return false; + + // declaring type + ReferenceBinding declaringType = method.declaringClass; + if (declaringType != null) { + if (!method.isStatic() && !method.isPrivate()) { + if (!this.matchesAsSubtype(declaringType, this.declaringSimpleName, this.declaringQualification)) + return false; + } else { + if (!this.matchesType(this.declaringSimpleName, this.declaringQualification, declaringType)) + return false; + } + } + + // return type + if (!this.matchesType(this.returnSimpleName, this.returnQualification, method.returnType)) { + return false; + } + + // parameter types + int parameterCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; + if (parameterCount > -1) { + int argumentCount = method.parameters == null ? 0 : method.parameters.length; + if (parameterCount != argumentCount) + return false; + for (int i = 0; i < parameterCount; i++) { + char[] qualification = this.parameterQualifications[i]; + char[] type = this.parameterSimpleNames[i]; + if (!this.matchesType(type, qualification, method.parameters[i])) + return false; + } + } + + return true; +} +/** * @see SearchPattern#matchesBinary(Object, Object) */ public boolean matchesBinary(Object binaryInfo, Object enclosingBinaryInfo) { @@ -135,104 +246,4 @@ return true; } - -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - if (!(node instanceof MethodDeclaration)) return IMPOSSIBLE_MATCH; - - MethodDeclaration method = (MethodDeclaration)node; - - if (resolve) { - return this.matchLevel(method.binding); - } else { - // selector - if (!this.matchesName(this.selector, method.selector)) - return IMPOSSIBLE_MATCH; - - // return type - TypeReference methodReturnType = method.returnType; - if (methodReturnType != null) { - char[][] methodReturnTypeName = methodReturnType.getTypeName(); - char[] sourceName = this.toArrayName( - methodReturnTypeName[methodReturnTypeName.length-1], - methodReturnType.dimensions()); - if (!this.matchesName(this.returnSimpleName, sourceName)) - return IMPOSSIBLE_MATCH; - } - - // parameter types - int parameterCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; - if (parameterCount > -1) { - int argumentCount = method.arguments == null ? 0 : method.arguments.length; - if (parameterCount != argumentCount) - return IMPOSSIBLE_MATCH; - } - - return POSSIBLE_MATCH; - } -} - -/** - * @see SearchPattern#matchLevel(Binding) - */ -public int matchLevel(Binding binding) { - if (binding == null) return INACCURATE_MATCH; - if (!(binding instanceof MethodBinding)) return IMPOSSIBLE_MATCH; - int level; - - MethodBinding method = (MethodBinding)binding; - - // selector - if (!this.matchesName(this.selector, method.selector)) - return IMPOSSIBLE_MATCH; - - // declaring type - ReferenceBinding declaringType = method.declaringClass; - if (!method.isStatic() && !method.isPrivate()) { - level = this.matchLevelAsSubtype(declaringType, this.declaringSimpleName, this.declaringQualification); - } else { - level = this.matchLevelForType(this.declaringSimpleName, this.declaringQualification, declaringType); - } - if (level == IMPOSSIBLE_MATCH) { - return IMPOSSIBLE_MATCH; - } - - // return type - int newLevel = this.matchLevelForType(this.returnSimpleName, this.returnQualification, method.returnType); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - return IMPOSSIBLE_MATCH; - case ACCURATE_MATCH: // keep previous level - break; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; - } - - // parameter types - int parameterCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; - if (parameterCount > -1) { - int argumentCount = method.parameters == null ? 0 : method.parameters.length; - if (parameterCount != argumentCount) - return IMPOSSIBLE_MATCH; - for (int i = 0; i < parameterCount; i++) { - char[] qualification = this.parameterQualifications[i]; - char[] type = this.parameterSimpleNames[i]; - newLevel = this.matchLevelForType(type, qualification, method.parameters[i]); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - return IMPOSSIBLE_MATCH; - case ACCURATE_MATCH: // keep previous level - break; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; - } - } - } - - return level; -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java b/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java index d1146ef..52f4c32 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java
@@ -85,45 +85,45 @@ if (declaringQualification != null) buffer.append(declaringQualification).append('.'); if (declaringSimpleName != null) buffer.append(declaringSimpleName).append('.'); - else if (declaringQualification != null) buffer.append("*."/*nonNLS*/); + else if (declaringQualification != null) buffer.append("*."); if (selector != null) { buffer.append(selector); } else { - buffer.append("*"/*nonNLS*/); + buffer.append("*"); } buffer.append('('); if (parameterSimpleNames == null) { - buffer.append("..."/*nonNLS*/); + buffer.append("..."); } else { for (int i = 0, max = parameterSimpleNames.length; i < max; i++){ - if (i > 0) buffer.append(", "/*nonNLS*/); + if (i > 0) buffer.append(", "); if (parameterQualifications[i] != null) buffer.append(parameterQualifications[i]).append('.'); if (parameterSimpleNames[i] == null) buffer.append('*'); else buffer.append(parameterSimpleNames[i]); } } buffer.append(')'); if (returnQualification != null) - buffer.append(" --> "/*nonNLS*/).append(returnQualification).append('.'); - else if (returnSimpleName != null) buffer.append(" --> "/*nonNLS*/); + buffer.append(" --> ").append(returnQualification).append('.'); + else if (returnSimpleName != null) buffer.append(" --> "); if (returnSimpleName != null) buffer.append(returnSimpleName); - else if (returnQualification != null) buffer.append("*"/*nonNLS*/); - buffer.append(", "/*nonNLS*/); + else if (returnQualification != null) buffer.append("*"); + buffer.append(", "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/MethodReferencePattern.java b/search/org/eclipse/jdt/internal/core/search/matching/MethodReferencePattern.java index 07a6394..925016b 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/MethodReferencePattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/MethodReferencePattern.java
@@ -70,7 +70,7 @@ } } public String getPatternName(){ - return "MethodReferencePattern: "/*nonNLS*/; + return "MethodReferencePattern: "; } /** * @see SearchPattern#indexEntryPrefix @@ -84,120 +84,76 @@ isCaseSensitive); } /** + * Returns whether the code gen will use an invoke virtual for + * this message send or not. + */ +private boolean isVirtualInvoke(MessageSend messageSend) { + return !messageSend.binding.isStatic() && !messageSend.isSuperAccess() && !messageSend.binding.isPrivate(); +} +/** * @see SearchPattern#matchContainer() */ protected int matchContainer() { return METHOD | FIELD; } - -public boolean initializeFromLookupEnvironment(LookupEnvironment env) { - this.allSuperDeclaringTypeNames = this.collectSuperTypeNames(this.declaringQualification, this.declaringSimpleName, this.matchMode, env); - return this.allSuperDeclaringTypeNames == null || this.allSuperDeclaringTypeNames != NOT_FOUND_DECLARING_TYPE; -} - /** - * Returns whether the code gen will use an invoke virtual for - * this message send or not. + * @see SearchPattern#matches(AstNode, boolean) */ -private boolean isVirtualInvoke(MethodBinding method, MessageSend messageSend) { - return !method.isStatic() && !messageSend.isSuperAccess() && !method.isPrivate(); -} +protected boolean matches(AstNode node, boolean resolve) { + if (!(node instanceof MessageSend)) return false; -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - if (!(node instanceof MessageSend)) return IMPOSSIBLE_MATCH; MessageSend messageSend = (MessageSend)node; - if (resolve) { - return this.matchLevel(messageSend.binding, messageSend); - } else { - // selector - if (this.selector != null && !this.matchesName(this.selector, messageSend.selector)) - return IMPOSSIBLE_MATCH; - - // argument types - int argumentCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; - if (argumentCount > -1) { - int parameterCount = messageSend.arguments == null ? 0 : messageSend.arguments.length; - if (parameterCount != argumentCount) - return IMPOSSIBLE_MATCH; - } - - return POSSIBLE_MATCH; - } -} - -/** - * @see SearchPattern#matchLevel(Binding) - */ -public int matchLevel(Binding binding, MessageSend messageSend) { - if (binding == null) return INACCURATE_MATCH; - if (!(binding instanceof MethodBinding)) return IMPOSSIBLE_MATCH; - int level; - - MethodBinding method = (MethodBinding)binding; - // selector - if (this.selector != null && !this.matchesName(this.selector, method.selector)) - return IMPOSSIBLE_MATCH; + if (this.selector != null && !this.matchesName(this.selector, messageSend.selector)) + return false; // receiver type + MethodBinding binding = messageSend.binding; ReferenceBinding receiverType = binding == null ? null : - (!isVirtualInvoke(method, messageSend) ? method.declaringClass : (ReferenceBinding)messageSend.receiverType); - if (this.isVirtualInvoke(method, messageSend)) { - level = this.matchLevelAsSubtype(receiverType, this.declaringSimpleName, this.declaringQualification); - if (level == IMPOSSIBLE_MATCH) { - level = this.matchLevelForType(this.allSuperDeclaringTypeNames, receiverType); - if (level == IMPOSSIBLE_MATCH) { - return IMPOSSIBLE_MATCH; + (!isVirtualInvoke(messageSend) ? binding.declaringClass : (ReferenceBinding)messageSend.receiverType); + if (resolve && receiverType != null) { + if (this.isVirtualInvoke(messageSend)) { + if (!this.matchesAsSubtype(receiverType, this.declaringSimpleName, this.declaringQualification) + && !this.matchesType(this.allSuperDeclaringTypeNames, receiverType)) { + return false; } + } else { + if (!this.matchesType(this.declaringSimpleName, this.declaringQualification, receiverType)) + return false; } - } else { - level = this.matchLevelForType(this.declaringSimpleName, this.declaringQualification, receiverType); - if (level == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH; } // return type - int newLevel = this.matchLevelForType(this.returnSimpleName, this.returnQualification, method.returnType); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - return IMPOSSIBLE_MATCH; - case ACCURATE_MATCH: // keep previous level - break; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; + if (resolve && binding != null) { + if (!this.matchesType(this.returnSimpleName, this.returnQualification, binding.returnType)) + return false; } // argument types int argumentCount = this.parameterSimpleNames == null ? -1 : this.parameterSimpleNames.length; if (argumentCount > -1) { - if (method.parameters == null) { - level = INACCURATE_MATCH; - } else { - int parameterCount = method.parameters.length; - if (parameterCount != argumentCount) return IMPOSSIBLE_MATCH; + int parameterCount = messageSend.arguments == null ? 0 : messageSend.arguments.length; + if (parameterCount != argumentCount) + return false; + + if (resolve && binding != null) { for (int i = 0; i < parameterCount; i++) { char[] qualification = this.parameterQualifications[i]; char[] type = this.parameterSimpleNames[i]; - newLevel = this.matchLevelForType(type, qualification, method.parameters[i]); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - return IMPOSSIBLE_MATCH; - case ACCURATE_MATCH: // keep previous level - break; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; - } + if (!this.matchesType(type, qualification, binding.parameters[i])) + return false; } } } - return level; + return true; +} + +public boolean initializeFromLookupEnvironment(LookupEnvironment env) { + this.allSuperDeclaringTypeNames = this.collectSuperTypeNames(this.declaringQualification, this.declaringSimpleName, this.matchMode, env); + return this.allSuperDeclaringTypeNames == null || this.allSuperDeclaringTypeNames != NOT_FOUND_DECLARING_TYPE; } }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java b/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java index fd41c4a..bd31150 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java
@@ -77,6 +77,18 @@ | rightPattern.matchContainer(); } /** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + return this.leftPattern.matches(node, resolve) || this.rightPattern.matches(node, resolve); +} +/** + * @see SearchPattern#matches(Binding) + */ +public boolean matches(Binding binding) { + return this.leftPattern.matches(binding) || this.rightPattern.matches(binding); +} +/** * see SearchPattern.matchIndexEntry */ protected boolean matchIndexEntry() { @@ -88,15 +100,14 @@ * @see SearchPattern#matchReportReference */ protected void matchReportReference(AstNode reference, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { - int leftLevel = this.leftPattern.matchLevel(reference, true); - if (leftLevel == ACCURATE_MATCH || leftLevel == INACCURATE_MATCH) { + if (this.leftPattern.matches(reference)) { this.leftPattern.matchReportReference(reference, element, accuracy, locator); } else { this.rightPattern.matchReportReference(reference, element, accuracy, locator); } } public String toString(){ - return this.leftPattern.toString() + "\n| "/*nonNLS*/ + this.rightPattern.toString(); + return this.leftPattern.toString() + "\n| " + this.rightPattern.toString(); } /** @@ -109,50 +120,4 @@ boolean rightInit = this.rightPattern.initializeFromLookupEnvironment(env); return leftInit || rightInit; } - -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - switch (this.leftPattern.matchLevel(node, resolve)) { - case IMPOSSIBLE_MATCH: - return this.rightPattern.matchLevel(node, resolve); - case POSSIBLE_MATCH: - return POSSIBLE_MATCH; - case INACCURATE_MATCH: - int rightLevel = this.rightPattern.matchLevel(node, resolve); - if (rightLevel != IMPOSSIBLE_MATCH) { - return rightLevel; - } else { - return INACCURATE_MATCH; - } - case ACCURATE_MATCH: - return ACCURATE_MATCH; - default: - return IMPOSSIBLE_MATCH; - } -} - -/** - * @see SearchPattern#matchLevel(Binding) - */ -public int matchLevel(Binding binding) { - switch (this.leftPattern.matchLevel(binding)) { - case IMPOSSIBLE_MATCH: - return this.rightPattern.matchLevel(binding); - case POSSIBLE_MATCH: - return POSSIBLE_MATCH; - case INACCURATE_MATCH: - int rightLevel = this.rightPattern.matchLevel(binding); - if (rightLevel != IMPOSSIBLE_MATCH) { - return rightLevel; - } else { - return INACCURATE_MATCH; - } - case ACCURATE_MATCH: - return ACCURATE_MATCH; - default: - return IMPOSSIBLE_MATCH; - } -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java b/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java index 5f26202..82d9baa 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java
@@ -51,6 +51,13 @@ return 0; } /** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + // used only in the case of a OrPattern + return true; +} +/** * @see SearchPattern#matchIndexEntry */ protected boolean matchIndexEntry() { @@ -59,32 +66,24 @@ } public String toString(){ StringBuffer buffer = new StringBuffer(20); - buffer.append("PackageDeclarationPattern: <"/*nonNLS*/); + buffer.append("PackageDeclarationPattern: <"); if (this.pkgName != null) buffer.append(this.pkgName); - buffer.append(">, "/*nonNLS*/); + buffer.append(">, "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } - -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - // used only in the case of a OrPattern - return ACCURATE_MATCH; -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java b/search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java index ea8cc7b..9a3bf39 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java
@@ -102,6 +102,110 @@ return this.matchesName(this.pkgName, name); } /** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + if (node instanceof QualifiedTypeReference) { + return this.matches((QualifiedTypeReference)node, resolve); + } else if (node instanceof ImportReference) { + return this.matches((ImportReference)node, resolve); + } else if (node instanceof QualifiedNameReference) { + return this.matches((QualifiedNameReference)node, resolve); + } + return false; +} +/** + * Returns whether this package reference pattern matches the given import reference. + * Look at resolved information only if specified. + */ +private boolean matches(ImportReference importRef, boolean resolve) { + if (importRef.onDemand) { + return this.matches(importRef.tokens); + } else { + int length = importRef.tokens.length - 1; + char[][] tokens = new char[length][]; + System.arraycopy(importRef.tokens, 0, tokens, 0, length); + return this.matches(tokens); + } +} +/** + * Returns whether this package reference pattern matches the given qualified name reference. + * Look at resolved information only if specified. + */ +private boolean matches(QualifiedNameReference qNameRef, boolean resolve) { + Binding binding = qNameRef.binding; + if (!resolve || binding == null || !binding.isValidBinding()) { + if (this.pkgName != null) { + switch (this.matchMode) { + case EXACT_MATCH: + case PREFIX_MATCH: + return CharOperation.prefixEquals(this.pkgName, CharOperation.concatWith(qNameRef.tokens, '.'), this.isCaseSensitive); + case PATTERN_MATCH: + char[] pattern = this.pkgName[this.pkgName.length-1] == '*' ? this.pkgName : CharOperation.concat(this.pkgName, ".*".toCharArray()); + return CharOperation.match(pattern, CharOperation.concatWith(qNameRef.tokens, '.'), this.isCaseSensitive); + } + } + } else { + TypeBinding typeBinding = null; + char[][] tokens = qNameRef.tokens; + int lastIndex = tokens.length-1; + switch (qNameRef.bits & Statement.RestrictiveFlagMASK) { + case BindingIds.FIELD : // reading a field + typeBinding = ((FieldBinding)binding).declaringClass; + // no valid match amongst fields + int otherBindingsCount = qNameRef.otherBindings == null ? 0 : qNameRef.otherBindings.length; + lastIndex -= otherBindingsCount + 1; + if (lastIndex < 0) return false; + break; + case BindingIds.LOCAL : // reading a local variable + return false; // no package match in it + case BindingIds.TYPE : //=============only type ============== + typeBinding = (TypeBinding)binding; + } + if (typeBinding instanceof ArrayBinding) { + typeBinding = ((ArrayBinding)typeBinding).leafComponentType; + } + if (typeBinding instanceof ReferenceBinding) { + PackageBinding pkgBinding = ((ReferenceBinding)typeBinding).fPackage; + return this.matches(pkgBinding.compoundName); + } + return false; + } + return true; +} +/** + * Returns whether this package reference pattern matches the given type reference. + * Look at resolved information only if specified. + */ +private boolean matches(QualifiedTypeReference typeRef, boolean resolve) { + if (!resolve) { + if (this.pkgName != null) { + switch (this.matchMode) { + case EXACT_MATCH: + case PREFIX_MATCH: + return CharOperation.prefixEquals(this.pkgName, CharOperation.concatWith(typeRef.tokens, '.'), this.isCaseSensitive); + case PATTERN_MATCH: + char[] pattern = this.pkgName[this.pkgName.length-1] == '*' ? this.pkgName : CharOperation.concat(this.pkgName, ".*".toCharArray()); + return CharOperation.match(pattern, CharOperation.concatWith(typeRef.tokens, '.'), this.isCaseSensitive); + } + } + } else { + TypeBinding typeBinding = typeRef.binding; + if (typeBinding != null){ + if (typeBinding instanceof ArrayBinding) { + typeBinding = ((ArrayBinding)typeBinding).leafComponentType; + } + if (typeBinding instanceof ReferenceBinding) { + PackageBinding pkgBinding = ((ReferenceBinding)typeBinding).fPackage; + return this.matches(pkgBinding.compoundName); + } + return false; + } + + } + return true; +} +/** * @see SearchPattern#matchIndexEntry */ protected boolean matchIndexEntry() { @@ -142,186 +246,24 @@ } public String toString(){ StringBuffer buffer = new StringBuffer(20); - buffer.append("PackageReferencePattern: <"/*nonNLS*/); + buffer.append("PackageReferencePattern: <"); if (this.pkgName != null) buffer.append(this.pkgName); - buffer.append(">, "/*nonNLS*/); + buffer.append(">, "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } - -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - if (node instanceof QualifiedTypeReference) { - return this.matchLevel((QualifiedTypeReference)node, resolve); - } else if (node instanceof ImportReference) { - return this.matchLevel((ImportReference)node, resolve); - } else if (node instanceof QualifiedNameReference) { - return this.matchLevel((QualifiedNameReference)node, resolve); - } - return IMPOSSIBLE_MATCH; -} - -/** - * Returns whether this package reference pattern matches the given import reference. - * Look at resolved information only if specified. - */ -private int matchLevel(ImportReference importRef, boolean resolve) { - if (importRef.onDemand) { - if (this.matches(importRef.tokens)) { - return ACCURATE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - } else { - int length = importRef.tokens.length - 1; - char[][] tokens = new char[length][]; - System.arraycopy(importRef.tokens, 0, tokens, 0, length); - if (this.matches(tokens)) { - return ACCURATE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - } -} - -/** - * Returns whether this package reference pattern matches the given qualified name reference. - * Look at resolved information only if specified. - */ -private int matchLevel(QualifiedNameReference qNameRef, boolean resolve) { - if (!resolve) { - if (this.pkgName == null) { - return POSSIBLE_MATCH; - } else { - switch (this.matchMode) { - case EXACT_MATCH: - case PREFIX_MATCH: - if (CharOperation.prefixEquals(this.pkgName, CharOperation.concatWith(qNameRef.tokens, '.'), this.isCaseSensitive)) { - return POSSIBLE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - case PATTERN_MATCH: - char[] pattern = this.pkgName[this.pkgName.length-1] == '*' ? this.pkgName : CharOperation.concat(this.pkgName, ".*"/*nonNLS*/.toCharArray()); - if (CharOperation.match(pattern, CharOperation.concatWith(qNameRef.tokens, '.'), this.isCaseSensitive)) { - return POSSIBLE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - default: - return IMPOSSIBLE_MATCH; - } - } - } else { - Binding binding = qNameRef.binding; - if (binding == null) { - return INACCURATE_MATCH; - } else { - TypeBinding typeBinding = null; - char[][] tokens = qNameRef.tokens; - int lastIndex = tokens.length-1; - switch (qNameRef.bits & Statement.RestrictiveFlagMASK) { - case BindingIds.FIELD : // reading a field - typeBinding = ((FieldBinding)binding).declaringClass; - // no valid match amongst fields - int otherBindingsCount = qNameRef.otherBindings == null ? 0 : qNameRef.otherBindings.length; - lastIndex -= otherBindingsCount + 1; - if (lastIndex < 0) return IMPOSSIBLE_MATCH; - break; - case BindingIds.LOCAL : // reading a local variable - return IMPOSSIBLE_MATCH; // no package match in it - case BindingIds.TYPE : //=============only type ============== - typeBinding = (TypeBinding)binding; - } - if (typeBinding instanceof ArrayBinding) { - typeBinding = ((ArrayBinding)typeBinding).leafComponentType; - } - if (typeBinding == null) { - return INACCURATE_MATCH; - } else { - if (typeBinding instanceof ReferenceBinding) { - PackageBinding pkgBinding = ((ReferenceBinding)typeBinding).fPackage; - if (pkgBinding == null) { - return INACCURATE_MATCH; - } else if (this.matches(pkgBinding.compoundName)) { - return ACCURATE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - } else { - return IMPOSSIBLE_MATCH; - } - } - } - } -} - -/** - * Returns whether this package reference pattern matches the given type reference. - * Look at resolved information only if specified. - */ -private int matchLevel(QualifiedTypeReference typeRef, boolean resolve) { - if (!resolve) { - if (this.pkgName == null) { - return POSSIBLE_MATCH; - } else { - switch (this.matchMode) { - case EXACT_MATCH: - case PREFIX_MATCH: - if (CharOperation.prefixEquals(this.pkgName, CharOperation.concatWith(typeRef.tokens, '.'), this.isCaseSensitive)) { - return POSSIBLE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - case PATTERN_MATCH: - char[] pattern = this.pkgName[this.pkgName.length-1] == '*' ? this.pkgName : CharOperation.concat(this.pkgName, ".*"/*nonNLS*/.toCharArray()); - if (CharOperation.match(pattern, CharOperation.concatWith(typeRef.tokens, '.'), this.isCaseSensitive)) { - return POSSIBLE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - default: - return IMPOSSIBLE_MATCH; - } - } - } else { - TypeBinding typeBinding = typeRef.binding; - if (typeBinding == null) { - return INACCURATE_MATCH; - } else { - if (typeBinding instanceof ArrayBinding) { - typeBinding = ((ArrayBinding)typeBinding).leafComponentType; - } - if (typeBinding == null) { - return INACCURATE_MATCH; - } else if (typeBinding instanceof ReferenceBinding) { - PackageBinding pkgBinding = ((ReferenceBinding)typeBinding).fPackage; - if (this.matches(pkgBinding.compoundName)) { - return ACCURATE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - } else { - return IMPOSSIBLE_MATCH; - } - } - - } -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/SearchPattern.java b/search/org/eclipse/jdt/internal/core/search/matching/SearchPattern.java index 27d7099..53fef87 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/SearchPattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/SearchPattern.java
@@ -33,14 +33,14 @@ /* match level */ public static final int IMPOSSIBLE_MATCH = 0; public static final int POSSIBLE_MATCH = 1; + public static final int TRUSTED_MATCH = 2; + /* match container */ public static final int COMPILATION_UNIT = 1; public static final int CLASS = 2; public static final int FIELD = 4; public static final int METHOD = 8; - public static final int ACCURATE_MATCH = 2; - public static final int INACCURATE_MATCH = 3; public static final char[][][] NOT_FOUND_DECLARING_TYPE = new char[0][][]; public SearchPattern(int matchMode, boolean isCaseSensitive) { @@ -54,7 +54,7 @@ */ private static SearchPattern createConstructorPattern(String patternString, int limitTo, int matchMode, boolean isCaseSensitive) { - StringTokenizer tokenizer = new StringTokenizer(patternString, " .(,)"/*nonNLS*/, true); + StringTokenizer tokenizer = new StringTokenizer(patternString, " .(,)", true); final int InsideName = 1; final int InsideParameter = 2; String lastToken = null; @@ -71,7 +71,7 @@ // read declaring type and selector case InsideName : - if (token.equals("."/*nonNLS*/)){ + if (token.equals(".")){ if (declaringQualification == null){ if (typeName == null) return null; declaringQualification = typeName; @@ -79,12 +79,12 @@ declaringQualification += token + typeName; } typeName = null; - } else if (token.equals("("/*nonNLS*/)){ + } else if (token.equals("(")){ parameterTypes = new String[5]; parameterCount = 0; mode = InsideParameter; - } else if (token.equals(" "/*nonNLS*/)){ - if (!(" "/*nonNLS*/.equals(lastToken) || "."/*nonNLS*/.equals(lastToken))){ + } else if (token.equals(" ")){ + if (!(" ".equals(lastToken) || ".".equals(lastToken))){ break; } } else { // name @@ -94,15 +94,15 @@ break; // read parameter types case InsideParameter : - if (token.equals(" "/*nonNLS*/)){ - } else if (token.equals(","/*nonNLS*/)){ + if (token.equals(" ")){ + } else if (token.equals(",")){ if (parameterType == null) return null; if (parameterTypes.length == parameterCount){ System.arraycopy(parameterTypes, 0, parameterTypes = new String[parameterCount*2], 0, parameterCount); } parameterTypes[parameterCount++] = parameterType; parameterType = null; - } else if (token.equals (")"/*nonNLS*/)){ + } else if (token.equals (")")){ foundClosingParenthesis = true; if (parameterType != null){ if (parameterTypes.length == parameterCount){ @@ -115,7 +115,7 @@ if (parameterType == null){ parameterType = token; } else { - if (!("."/*nonNLS*/.equals(lastToken) || "."/*nonNLS*/.equals(token) || "[]"/*nonNLS*/.equals(token))) return null; + if (!(".".equals(lastToken) || ".".equals(token) || "[]".equals(token))) return null; parameterType += token; } } @@ -176,7 +176,7 @@ */ private static SearchPattern createFieldPattern(String patternString, int limitTo, int matchMode, boolean isCaseSensitive) { - StringTokenizer tokenizer = new StringTokenizer(patternString, " .(,)"/*nonNLS*/, true); + StringTokenizer tokenizer = new StringTokenizer(patternString, " .(,)", true); final int InsideDeclaringPart = 1; final int InsideType = 2; String lastToken = null; @@ -191,7 +191,7 @@ // read declaring type and fieldName case InsideDeclaringPart : - if (token.equals("."/*nonNLS*/)){ + if (token.equals(".")){ if (declaringType == null){ if (fieldName == null) return null; declaringType = fieldName; @@ -199,8 +199,8 @@ declaringType += token + fieldName; } fieldName = null; - } else if (token.equals(" "/*nonNLS*/)){ - if (!(" "/*nonNLS*/.equals(lastToken) || "."/*nonNLS*/.equals(lastToken))){ + } else if (token.equals(" ")){ + if (!(" ".equals(lastToken) || ".".equals(lastToken))){ mode = InsideType; } } else { // name @@ -210,11 +210,11 @@ break; // read type case InsideType: - if (!token.equals(" "/*nonNLS*/)){ + if (!token.equals(" ")){ if (type == null){ type = token; } else { - if (!(!("."/*nonNLS*/.equals(lastToken) || "."/*nonNLS*/.equals(token) || "[]"/*nonNLS*/.equals(token)))) return null; + if (!(!(".".equals(lastToken) || ".".equals(token) || "[]".equals(token)))) return null; type += token; } } @@ -281,7 +281,7 @@ */ private static SearchPattern createMethodPattern(String patternString, int limitTo, int matchMode, boolean isCaseSensitive) { - StringTokenizer tokenizer = new StringTokenizer(patternString, " .(,)"/*nonNLS*/, true); + StringTokenizer tokenizer = new StringTokenizer(patternString, " .(,)", true); final int InsideSelector = 1; final int InsideParameter = 2; final int InsideReturnType = 3; @@ -299,7 +299,7 @@ // read declaring type and selector case InsideSelector : - if (token.equals("."/*nonNLS*/)){ + if (token.equals(".")){ if (declaringType == null){ if (selector == null) return null; declaringType = selector; @@ -307,12 +307,12 @@ declaringType += token + selector; } selector = null; - } else if (token.equals("("/*nonNLS*/)){ + } else if (token.equals("(")){ parameterTypes = new String[5]; parameterCount = 0; mode = InsideParameter; - } else if (token.equals(" "/*nonNLS*/)){ - if (!(" "/*nonNLS*/.equals(lastToken) || "."/*nonNLS*/.equals(lastToken))){ + } else if (token.equals(" ")){ + if (!(" ".equals(lastToken) || ".".equals(lastToken))){ mode = InsideReturnType; } } else { // name @@ -322,15 +322,15 @@ break; // read parameter types case InsideParameter : - if (token.equals(" "/*nonNLS*/)){ - } else if (token.equals(","/*nonNLS*/)){ + if (token.equals(" ")){ + } else if (token.equals(",")){ if (parameterType == null) return null; if (parameterTypes.length == parameterCount){ System.arraycopy(parameterTypes, 0, parameterTypes = new String[parameterCount*2], 0, parameterCount); } parameterTypes[parameterCount++] = parameterType; parameterType = null; - } else if (token.equals (")"/*nonNLS*/)){ + } else if (token.equals (")")){ foundClosingParenthesis = true; if (parameterType != null){ if (parameterTypes.length == parameterCount){ @@ -343,18 +343,18 @@ if (parameterType == null){ parameterType = token; } else { - if (!("."/*nonNLS*/.equals(lastToken) || "."/*nonNLS*/.equals(token) || "[]"/*nonNLS*/.equals(token))) return null; + if (!(".".equals(lastToken) || ".".equals(token) || "[]".equals(token))) return null; parameterType += token; } } break; // read return type case InsideReturnType: - if (!token.equals(" "/*nonNLS*/)){ + if (!token.equals(" ")){ if (returnType == null){ returnType = token; } else { - if (!(!("."/*nonNLS*/.equals(lastToken) || "."/*nonNLS*/.equals(token) || "[]"/*nonNLS*/.equals(token)))) return null; + if (!(!(".".equals(lastToken) || ".".equals(token) || "[]".equals(token)))) return null; returnType += token; } } @@ -643,16 +643,16 @@ */ private static SearchPattern createTypePattern(String patternString, int limitTo, int matchMode, boolean isCaseSensitive) { - StringTokenizer tokenizer = new StringTokenizer(patternString, " ."/*nonNLS*/, true); + StringTokenizer tokenizer = new StringTokenizer(patternString, " .", true); String type = null; String lastToken = null; while (tokenizer.hasMoreTokens()){ String token = tokenizer.nextToken(); - if (!token.equals(" "/*nonNLS*/)){ + if (!token.equals(" ")){ if (type == null){ type = token; } else { - if (!("."/*nonNLS*/.equals(lastToken) || "."/*nonNLS*/.equals(token) || "[]"/*nonNLS*/.equals(token))) return null; + if (!(".".equals(lastToken) || ".".equals(token) || "[]".equals(token))) return null; type += token; } } @@ -753,6 +753,24 @@ */ protected abstract int matchContainer(); /** + * Finds out whether the given resolved ast node matches this search pattern. + */ +public boolean matches(AstNode node) { + return this.matches(node, true); +} +/** + * Returns whether this pattern matches the given node. + * Look at resolved information only if specified. + */ +protected abstract boolean matches(AstNode node, boolean resolve); +/** + * Finds out whether the given binding matches this search pattern. + * Default is to return false. + */ +public boolean matches(Binding binding) { + return false; +} +/** * Finds out whether the given binary info matches this search pattern. * Default is to return false. */ @@ -802,10 +820,43 @@ ); } /** + * Returns whether the given type binding matches the given simple name pattern + * and qualification pattern. + */ +protected boolean matchesType(char[] simpleNamePattern, char[] qualificationPattern, TypeBinding type) { + if (type == null) return false; + return + this.matchesType( + simpleNamePattern, + qualificationPattern, + type.qualifiedPackageName().length == 0 ? + type.qualifiedSourceName() : + CharOperation.concat(type.qualifiedPackageName(), type.qualifiedSourceName(), '.') + ); +} +/** * Checks whether an entry matches the current search pattern */ protected abstract boolean matchIndexEntry(); /** + * Finds out whether the given ast node matches this search pattern. + * Returns IMPOSSIBLE_MATCH if it doesn't. + * Returns TRUSTED_MATCH if it matches exactly this search pattern (ie. + * it doesn't need to be resolved or it has already been resolved.) + * Returns POSSIBLE_MATCH if it potentially matches + * this search pattern and it needs to be resolved to get more information. + */ +public int matchLevel(AstNode node) { + if (this.matches(node, false)) { + if (this.needsResolve) { + return POSSIBLE_MATCH; + } else { + return TRUSTED_MATCH; + } + } + return IMPOSSIBLE_MATCH; +} +/** * Reports the match of the given reference. */ protected void matchReportReference(AstNode reference, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { @@ -825,7 +876,7 @@ return result; } public String toString(){ - return "SearchPattern"/*nonNLS*/; + return "SearchPattern"; } /** @@ -923,103 +974,44 @@ } /** - * Finds out whether the given ast node matches this search pattern. - * Returns IMPOSSIBLE_MATCH if it doesn't. - * Returns POSSIBLE_MATCH if it potentially matches this search pattern - * and it has not been reolved, and it needs to be resolved to get more information. - * Returns ACCURATE_MATCH if it matches exactly this search pattern (ie. - * it doesn't need to be resolved or it has already been resolved.) - * Returns INACCURATE_MATCH if it potentially exactly this search pattern (ie. - * it has already been resolved but resolving failed.) - */ -public abstract int matchLevel(AstNode node, boolean resolve); - -/** - * Finds out whether the given binding matches this search pattern. - * Returns ACCURATE_MATCH if it does. - * Returns INACCURATE_MATCH if resolve failed. - * Default is to return INACCURATE_MATCH. - */ -public int matchLevel(Binding binding) { - return INACCURATE_MATCH; -} - -/** * Returns whether the given reference type binding matches or is a subtype of a type * that matches the given simple name pattern and qualification pattern. - * Returns ACCURATE_MATCH if it does. - * Returns INACCURATE_MATCH if resolve fails - * Returns IMPOSSIBLE_MATCH if it doesn't. */ -protected int matchLevelAsSubtype(ReferenceBinding type, char[] simpleNamePattern, char[] qualificationPattern) { - if (type == null) return INACCURATE_MATCH; - - int level; - +protected boolean matchesAsSubtype(ReferenceBinding type, char[] simpleNamePattern, char[] qualificationPattern) { // matches type - if ((level = this.matchLevelForType(simpleNamePattern, qualificationPattern, type)) != IMPOSSIBLE_MATCH) - return level; + if (this.matchesType(simpleNamePattern, qualificationPattern, type)) + return true; // matches superclass - if (!type.isInterface() && !CharOperation.equals(type.compoundName, TypeConstants.JAVA_LANG_OBJECT)) { - if ((level = this.matchLevelAsSubtype(type.superclass(), simpleNamePattern, qualificationPattern)) != IMPOSSIBLE_MATCH) { - return level; - } + ReferenceBinding superclass = type.superclass(); + if (superclass != null) { + if (this.matchesAsSubtype(superclass, simpleNamePattern, qualificationPattern)) + return true; } // matches interfaces ReferenceBinding[] interfaces = type.superInterfaces(); - if (interfaces == null) { - return INACCURATE_MATCH; - } else { - for (int i = 0; i < interfaces.length; i++) { - if ((level = this.matchLevelAsSubtype(interfaces[i], simpleNamePattern, qualificationPattern)) != IMPOSSIBLE_MATCH) { - return level; - }; - } + for (int i = 0; i < interfaces.length; i++) { + if (this.matchesAsSubtype(interfaces[i], simpleNamePattern, qualificationPattern)) + return true; } - return IMPOSSIBLE_MATCH; + return false; } /** * Returns whether one of the given declaring types is the given receiver type. - * Returns ACCURATE_MATCH if it does. - * Returns INACCURATE_MATCH if resolve failed. - * Returns IMPOSSIBLE_MATCH if it doesn't. */ -protected int matchLevelForType(char[][][] declaringTypes, ReferenceBinding receiverType) { - if (receiverType == null) return INACCURATE_MATCH; +protected boolean matchesType(char[][][] declaringTypes, ReferenceBinding receiverType) { if (declaringTypes == null) { - return INACCURATE_MATCH; // we were not able to compute the declaring types, default to inaccurate + return true; // we were not able to compute the declaring types, default to true } else { for (int i = 0, max = declaringTypes.length; i < max; i++) { if (CharOperation.equals(declaringTypes[i], receiverType.compoundName)) { - return ACCURATE_MATCH; + return true; } } - return IMPOSSIBLE_MATCH; - } -} - -/** - * Returns whether the given type binding matches the given simple name pattern - * and qualification pattern. - * Returns ACCURATE_MATCH if it does. - * Returns INACCURATE_MATCH if resolve failed. - * Returns IMPOSSIBLE_MATCH if it doesn't. - */ -protected int matchLevelForType(char[] simpleNamePattern, char[] qualificationPattern, TypeBinding type) { - if (type == null) return INACCURATE_MATCH; - if (this.matchesType( - simpleNamePattern, - qualificationPattern, - type.qualifiedPackageName().length == 0 ? - type.qualifiedSourceName() : - CharOperation.concat(type.qualifiedPackageName(), type.qualifiedSourceName(), '.'))) { - return ACCURATE_MATCH; - } else { - return IMPOSSIBLE_MATCH; + return false; } } }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/SuperInterfaceReferencePattern.java b/search/org/eclipse/jdt/internal/core/search/matching/SuperInterfaceReferencePattern.java index c6fd768..92d0bf3 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/SuperInterfaceReferencePattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/SuperInterfaceReferencePattern.java
@@ -7,14 +7,25 @@ import org.eclipse.jdt.internal.compiler.lookup.*; import org.eclipse.jdt.internal.core.search.indexing.*; -import org.eclipse.jdt.internal.compiler.util.CharOperation; -import org.eclipse.jdt.internal.compiler.env.IBinaryType; - public class SuperInterfaceReferencePattern extends SuperTypeReferencePattern { public SuperInterfaceReferencePattern(char[] superQualification, char[] superSimpleName, int matchMode, boolean isCaseSensitive) { super(superQualification, superSimpleName, matchMode, isCaseSensitive); } /** + * @see SearchPattern#matches(Binding) + */ +public boolean matches(Binding binding) { + if (!(binding instanceof ReferenceBinding)) return false; + + ReferenceBinding[] superInterfaces = ((ReferenceBinding)binding).superInterfaces(); + for (int i = 0, max = superInterfaces.length; i < max; i++){ + if (this.matchesType(this.superSimpleName, this.superQualification, superInterfaces[i])){ + return true; + } + } + return false; +} +/** * @see SearchPattern#matchIndexEntry */ protected boolean matchIndexEntry() { @@ -24,70 +35,24 @@ } public String toString(){ StringBuffer buffer = new StringBuffer(20); - buffer.append("SuperInterfaceReferencePattern: <"/*nonNLS*/); + buffer.append("SuperInterfaceReferencePattern: <"); if (superSimpleName != null) buffer.append(superSimpleName); - buffer.append(">, "/*nonNLS*/); + buffer.append(">, "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } - -/** - * @see SearchPattern#matchesBinary - */ -public boolean matchesBinary(Object binaryInfo, Object enclosingBinaryInfo) { - if (!(binaryInfo instanceof IBinaryType)) return false; - IBinaryType type = (IBinaryType)binaryInfo; - - char[][] superInterfaces = type.getInterfaceNames(); - if (superInterfaces != null) { - for (int i = 0, max = superInterfaces.length; i < max; i++) { - char[] superInterfaceName = (char[])superInterfaces[i].clone(); - CharOperation.replace(superInterfaceName, '/', '.'); - if (this.matchesType(this.superSimpleName, this.superQualification, superInterfaceName)){ - return true; - } - } - } - return false; -} - -/** - * @see SearchPattern#matchLevel(Binding) - */ -public int matchLevel(Binding binding) { - if (binding == null) return INACCURATE_MATCH; - if (!(binding instanceof ReferenceBinding)) return IMPOSSIBLE_MATCH; - - // super interfaces - int level = IMPOSSIBLE_MATCH; - ReferenceBinding type = (ReferenceBinding) binding; - ReferenceBinding[] superInterfaces = type.superInterfaces(); - for (int i = 0, max = superInterfaces.length; i < max; i++){ - int newLevel = this.matchLevelForType(this.superSimpleName, this.superQualification, superInterfaces[i]); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - break; - case ACCURATE_MATCH: - return ACCURATE_MATCH; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; - } - } - return level; -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java b/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java index 54ea3fa..1916a37 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java
@@ -16,8 +16,6 @@ import java.io.*; -import org.eclipse.jdt.internal.compiler.env.IBinaryType; - public class SuperTypeReferencePattern extends SearchPattern { public char[] superQualification; @@ -109,6 +107,51 @@ return CLASS; } /** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + if (!(node instanceof TypeReference)) return false; + + TypeReference typeRef = (TypeReference)node; + if (!resolve) { + if (this.superSimpleName != null) { + char[] typeRefSimpleName = null; + if (typeRef instanceof SingleTypeReference) { + typeRefSimpleName = ((SingleTypeReference)typeRef).token; + } else { // QualifiedTypeReference + char[][] tokens = ((QualifiedTypeReference)typeRef).tokens; + typeRefSimpleName = tokens[tokens.length-1]; + } + if (!this.matchesName(this.superSimpleName, typeRefSimpleName)) + return false; + } + } else { + TypeBinding binding = typeRef.binding; + if (binding != null && !this.matchesType(this.superSimpleName, this.superQualification, binding)) + return false; + } + return true; +} +/** + * @see SearchPattern#matches(Binding) + */ +public boolean matches(Binding binding) { + if (!(binding instanceof ReferenceBinding)) return false; + + ReferenceBinding type = (ReferenceBinding) binding; + if (this.matchesType(this.superSimpleName, this.superQualification, type.superclass())){ + return true; + } + + ReferenceBinding[] superInterfaces = type.superInterfaces(); + for (int i = 0, max = superInterfaces.length; i < max; i++){ + if (this.matchesType(this.superSimpleName, this.superQualification, superInterfaces[i])){ + return true; + } + } + return false; +} +/** * @see SearchPattern#matchIndexEntry */ protected boolean matchIndexEntry() { @@ -136,122 +179,24 @@ } public String toString(){ StringBuffer buffer = new StringBuffer(20); - buffer.append("SuperTypeReferencePattern: <"/*nonNLS*/); + buffer.append("SuperTypeReferencePattern: <"); if (superSimpleName != null) buffer.append(superSimpleName); - buffer.append(">, "/*nonNLS*/); + buffer.append(">, "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } - -/** - * @see SearchPattern#matchesBinary - */ -public boolean matchesBinary(Object binaryInfo, Object enclosingBinaryInfo) { - if (!(binaryInfo instanceof IBinaryType)) return false; - IBinaryType type = (IBinaryType)binaryInfo; - - char[] vmName = type.getSuperclassName(); - if (vmName != null) { - char[] superclassName = (char[])vmName.clone(); - CharOperation.replace(vmName, '/', '.'); - if (this.matchesType(this.superSimpleName, this.superQualification, superclassName)){ - return true; - } - } - - char[][] superInterfaces = type.getInterfaceNames(); - if (superInterfaces != null) { - for (int i = 0, max = superInterfaces.length; i < max; i++) { - char[] superInterfaceName = (char[])superInterfaces[i].clone(); - CharOperation.replace(superInterfaceName, '/', '.'); - if (this.matchesType(this.superSimpleName, this.superQualification, superInterfaceName)){ - return true; - } - } - } - return false; -} - -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - if (!(node instanceof TypeReference)) return IMPOSSIBLE_MATCH; - - TypeReference typeRef = (TypeReference)node; - if (resolve) { - TypeBinding binding = typeRef.binding; - if (binding == null) { - return INACCURATE_MATCH; - } else { - return this.matchLevelForType(this.superSimpleName, this.superQualification, binding); - } - } else { - if (this.superSimpleName == null) { - return POSSIBLE_MATCH; - } else { - char[] typeRefSimpleName = null; - if (typeRef instanceof SingleTypeReference) { - typeRefSimpleName = ((SingleTypeReference)typeRef).token; - } else { // QualifiedTypeReference - char[][] tokens = ((QualifiedTypeReference)typeRef).tokens; - typeRefSimpleName = tokens[tokens.length-1]; - } - if (this.matchesName(this.superSimpleName, typeRefSimpleName)) - return POSSIBLE_MATCH; - else - return IMPOSSIBLE_MATCH; - } - } -} - -/** - * @see SearchPattern#matchLevel(Binding) - */ -public int matchLevel(Binding binding) { - if (binding == null) return INACCURATE_MATCH; - if (!(binding instanceof ReferenceBinding)) return IMPOSSIBLE_MATCH; - - // super class - ReferenceBinding type = (ReferenceBinding) binding; - int level = this.matchLevelForType(this.superSimpleName, this.superQualification, type.superclass()); - switch (level) { - case IMPOSSIBLE_MATCH: - break; // try to find match in super interfaces - case ACCURATE_MATCH: - return ACCURATE_MATCH; - default: // ie. INACCURATE_MATCH - break; // try to find accurate match in super interfaces - } - - // super interfaces - ReferenceBinding[] superInterfaces = type.superInterfaces(); - for (int i = 0, max = superInterfaces.length; i < max; i++){ - int newLevel = this.matchLevelForType(this.superSimpleName, this.superQualification, superInterfaces[i]); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - break; - case ACCURATE_MATCH: - return ACCURATE_MATCH; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; - } - } - return level; -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java b/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java index 52f2b47..7970913 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java
@@ -116,6 +116,56 @@ return COMPILATION_UNIT | CLASS; } /** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + if (!(node instanceof TypeDeclaration)) return false; + + TypeDeclaration type = (TypeDeclaration)node; + + // type name + if (this.simpleName != null && !this.matchesName(this.simpleName, type.name)) + return false; + + if (resolve) { + // fully qualified name + TypeBinding binding = type.binding; + if (binding != null && !this.matches(binding)) { + return false; + } + } + + return true; +} +/** + * @see SearchPattern#matches(Binding) + */ +public boolean matches(Binding binding) { + if (!(binding instanceof TypeBinding)) return false; + + TypeBinding type = (TypeBinding)binding; + + // fully qualified name + char[] enclosingTypeName = this.enclosingTypeNames == null ? null : CharOperation.concatWith(this.enclosingTypeNames, '.'); + if (!this.matchesType(this.simpleName, this.qualification, enclosingTypeName, type)) { + return false; + } + + // class or interface + switch (this.classOrInterface) { + case CLASS_SUFFIX: + if (type.isInterface()) + return false; + break; + case INTERFACE_SUFFIX: + if (!type.isInterface()) + return false; + break; + } + + return true; +} +/** * @see SearchPattern#matchesBinary(Object, Object) */ public boolean matchesBinary(Object binaryInfo, Object enclosingBinaryInfo) { @@ -163,6 +213,26 @@ } } /** + * Returns whether the given type binding matches the given simple name pattern + * qualification pattern and enclosing type name pattern. + */ +protected boolean matchesType(char[] simpleNamePattern, char[] qualificationPattern, char[] enclosingNamePattern, TypeBinding type) { + if (enclosingNamePattern == null) { + return this.matchesType(simpleNamePattern, qualificationPattern, type); + } else { + char[] pattern; + if (qualificationPattern == null) { + return matchesType(simpleNamePattern, enclosingNamePattern, type); + } else { + // pattern was created from a Java element: qualification is the package name. + char[] fullQualificationPattern = CharOperation.concat(qualificationPattern, enclosingNamePattern, '.'); + return + this.matchesType(simpleNamePattern, fullQualificationPattern, type) + && CharOperation.equals(qualification, CharOperation.concatWith(type.getPackage().compoundName, '.')); + } + } +} +/** * see SearchPattern.matchIndexEntry */ protected boolean matchIndexEntry(){ @@ -212,17 +282,17 @@ StringBuffer buffer = new StringBuffer(20); switch (classOrInterface){ case CLASS_SUFFIX : - buffer.append("ClassDeclarationPattern: pkg<"/*nonNLS*/); + buffer.append("ClassDeclarationPattern: pkg<"); break; case INTERFACE_SUFFIX : - buffer.append("InterfaceDeclarationPattern: pkg<"/*nonNLS*/); + buffer.append("InterfaceDeclarationPattern: pkg<"); break; default : - buffer.append("TypeDeclarationPattern: pkg<"/*nonNLS*/); + buffer.append("TypeDeclarationPattern: pkg<"); break; } if (qualification != null) buffer.append(qualification); - buffer.append(">, enclosing<"/*nonNLS*/); + buffer.append(">, enclosing<"); if (enclosingTypeNames != null) { for (int i = 0; i < enclosingTypeNames.length; i++){ buffer.append(enclosingTypeNames[i]); @@ -230,92 +300,24 @@ buffer.append('.'); } } - buffer.append(">, type<"/*nonNLS*/); + buffer.append(">, type<"); if (simpleName != null) buffer.append(simpleName); - buffer.append(">, "/*nonNLS*/); + buffer.append(">, "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } - -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - if (!(node instanceof TypeDeclaration)) return IMPOSSIBLE_MATCH; - - TypeDeclaration type = (TypeDeclaration)node; - - if (resolve) { - return this.matchLevel(type.binding); - } else { - // type name - if (this.simpleName != null && !this.matchesName(this.simpleName, type.name)) - return IMPOSSIBLE_MATCH; - else - return POSSIBLE_MATCH; - } -} - -/** - * @see SearchPattern#matchLevel(Binding) - */ -public int matchLevel(Binding binding) { - if (binding == null) return INACCURATE_MATCH; - if (!(binding instanceof TypeBinding)) return IMPOSSIBLE_MATCH; - - TypeBinding type = (TypeBinding)binding; - - // class or interface - switch (this.classOrInterface) { - case CLASS_SUFFIX: - if (type.isInterface()) - return IMPOSSIBLE_MATCH; - break; - case INTERFACE_SUFFIX: - if (!type.isInterface()) - return IMPOSSIBLE_MATCH; - break; - } - - // fully qualified name - char[] enclosingTypeName = this.enclosingTypeNames == null ? null : CharOperation.concatWith(this.enclosingTypeNames, '.'); - return this.matchLevelForType(this.simpleName, this.qualification, enclosingTypeName, type); -} - -/** - * Returns whether the given type binding matches the given simple name pattern - * qualification pattern and enclosing type name pattern. - */ -protected int matchLevelForType(char[] simpleNamePattern, char[] qualificationPattern, char[] enclosingNamePattern, TypeBinding type) { - if (enclosingNamePattern == null) { - return this.matchLevelForType(simpleNamePattern, qualificationPattern, type); - } else { - char[] pattern; - if (qualificationPattern == null) { - return matchLevelForType(simpleNamePattern, enclosingNamePattern, type); - } else { - // pattern was created from a Java element: qualification is the package name. - char[] fullQualificationPattern = CharOperation.concat(qualificationPattern, enclosingNamePattern, '.'); - if ( CharOperation.equals(qualification, CharOperation.concatWith(type.getPackage().compoundName, '.'))) { - return this.matchLevelForType(simpleNamePattern, fullQualificationPattern, type); - } else { - return IMPOSSIBLE_MATCH; - } - } - } -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java b/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java index 9d3ac97..d77743e 100644 --- a/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java +++ b/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java
@@ -135,6 +135,183 @@ return COMPILATION_UNIT | CLASS | METHOD | FIELD; } /** + * @see SearchPattern#matches(AstNode, boolean) + */ +protected boolean matches(AstNode node, boolean resolve) { + if (node instanceof TypeReference) { + return this.matches((TypeReference)node, resolve); + } else if (node instanceof NameReference) { + return this.matches((NameReference)node, resolve); + } else if (node instanceof ImportReference) { + return this.matches((ImportReference)node, resolve); + } + return false; +} +/** + * Returns whether this type pattern matches the given import reference. + * Look at resolved information only if specified. + */ +private boolean matches(ImportReference importRef, boolean resolve) { + + if (importRef.onDemand) return false; + + char[][] tokens = importRef.tokens; + int importLength = tokens.length; + + if (this.qualification != null){ + char[][] qualificationTokens = CharOperation.splitOn('.', this.qualification); + int qualificationLength = qualificationTokens.length; + if (qualificationLength+1 > importLength) return false; + for (int i = 0; i < qualificationLength; i++){ + if (!this.matchesName(qualificationTokens[i], tokens[i])) { + return false; + } + } + if (this.simpleName != null + && !this.matchesName(this.simpleName, tokens[qualificationLength])) { + return false; + } + } else { + if (this.simpleName != null) { + for (int i = 0; i < importLength; i++){ + if (this.matchesName(this.simpleName, tokens[i])){ + return true; + } + } + return false; + } + } + return true; +} +/** + * Returns whether this type pattern matches the given name reference. + * Look at resolved information only if specified. + */ +private boolean matches(NameReference nameRef, boolean resolve) { + Binding binding = nameRef.binding; + if (!resolve || binding == null || !binding.isValidBinding()) { + if (this.simpleName != null) { + if (nameRef instanceof SingleNameReference) { + return this.matchesName(this.simpleName, ((SingleNameReference)nameRef).token); + } else { // QualifiedNameReference + char[][] tokens = ((QualifiedNameReference)nameRef).tokens; + for (int i = 0, max = tokens.length; i < max; i++){ + if (this.matchesName(this.simpleName, tokens[i])) return true; + } + return false; + } + } + } else { + if (nameRef instanceof SingleNameReference){ + if (binding instanceof TypeBinding){ + if (!this.matchesType(this.simpleName, this.qualification, (TypeBinding) binding)){ + return false; + } + } else { + return false; // must be a type binding + } + } else { // QualifiedNameReference + TypeBinding typeBinding = null; + QualifiedNameReference qNameRef = (QualifiedNameReference)nameRef; + char[][] tokens = qNameRef.tokens; + int lastIndex = tokens.length-1; + switch (qNameRef.bits & Statement.RestrictiveFlagMASK) { + case BindingIds.FIELD : // reading a field + typeBinding = ((FieldBinding)binding).declaringClass; + // no valid match amongst fields + int otherBindingsCount = qNameRef.otherBindings == null ? 0 : qNameRef.otherBindings.length; + lastIndex -= otherBindingsCount + 1; + if (lastIndex < 0) return false; + break; + case BindingIds.LOCAL : // reading a local variable + return false; // no type match in it + case BindingIds.TYPE : //=============only type ============== + typeBinding = (TypeBinding)binding; + } + // try to match all enclosing types for which the token matches as well. + while (typeBinding != null && lastIndex >= 0){ + if (matchesName(this.simpleName, tokens[lastIndex--]) + && matchesType(this.simpleName, this.qualification, typeBinding)) return true; + //&& matchesAsSubtype(this.simpleName, this.qualification, typeBinding)) return true; + if (typeBinding instanceof ReferenceBinding){ + typeBinding = ((ReferenceBinding)typeBinding).enclosingType(); + } else { + typeBinding = null; + } + } + return false; + } + } + return true; +} +/** + * Returns whether this type pattern matches the given type reference. + * Look at resolved information only if specified. + */ +private boolean matches(TypeReference typeRef, boolean resolve) { + if (!resolve) { + if (this.simpleName != null) { + if (typeRef instanceof SingleTypeReference) { + return this.matchesName(this.simpleName, ((SingleTypeReference)typeRef).token); + } else { // QualifiedTypeReference + char[][] tokens = ((QualifiedTypeReference)typeRef).tokens; + for (int i = 0, max = tokens.length; i < max; i++){ + if (this.matchesName(this.simpleName, tokens[i])) return true; + } + return false; + } + } + } else { + + TypeBinding typeBinding = typeRef.binding; + if (typeBinding != null){ + if (typeBinding instanceof ArrayBinding) typeBinding = ((ArrayBinding)typeBinding).leafComponentType; + if (typeRef instanceof SingleTypeReference){ + if (!this.matchesType(this.simpleName, this.qualification, typeBinding)){ + return false; + } + } else { // QualifiedTypeReference + QualifiedTypeReference qNameRef = (QualifiedTypeReference)typeRef; + char[][] tokens = qNameRef.tokens; + int lastIndex = tokens.length-1; + // try to match all enclosing types for which the token matches as well. + while (typeBinding != null && lastIndex >= 0){ + if (matchesName(this.simpleName, tokens[lastIndex--]) + && matchesType(this.simpleName, this.qualification, typeBinding)) return true; + //&& matchesAsSubtype(this.simpleName, this.qualification, typeBinding)) return true; + if (typeBinding instanceof ReferenceBinding){ + typeBinding = ((ReferenceBinding)typeBinding).enclosingType(); + } else { + typeBinding = null; + } + } + return false; + } + } + + } + return true; +} +/** + * @see SearchPattern#matches(Binding) + */ +public boolean matches(Binding binding) { + if (!(binding instanceof ReferenceBinding)) return false; + + ReferenceBinding type = (ReferenceBinding) binding; + if (this.matchesType(this.simpleName, this.qualification, type.superclass())){ + return true; + } + + ReferenceBinding[] superInterfaces = type.superInterfaces(); + for (int i = 0, max = superInterfaces.length; i < max; i++){ + if (this.matchesType(this.simpleName, this.qualification, superInterfaces[i])){ + return true; + } + } + return false; +} +/** * @see SearchPattern#matchIndexEntry */ protected boolean matchIndexEntry() { @@ -179,6 +356,26 @@ return true; } /** + * @see SearchPattern#matchLevel + */ +public int matchLevel(AstNode node) { + if (node instanceof NameReference) { + if (this.matches((NameReference)node, false)) { + return POSSIBLE_MATCH; // always need to resolve name reference + } else { + return IMPOSSIBLE_MATCH; + } + } else if (node instanceof ImportReference) { + if (this.matches((ImportReference)node, false)) { + return POSSIBLE_MATCH; + } else { + return IMPOSSIBLE_MATCH; + } + } else { + return super.matchLevel(node); + } +} +/** * @see SearchPattern#matchReportReference */ protected void matchReportReference(AstNode reference, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException { @@ -218,239 +415,26 @@ } public String toString(){ StringBuffer buffer = new StringBuffer(20); - buffer.append("TypeReferencePattern: pkg<"/*nonNLS*/); + buffer.append("TypeReferencePattern: pkg<"); if (qualification != null) buffer.append(qualification); - buffer.append(">, type<"/*nonNLS*/); + buffer.append(">, type<"); if (simpleName != null) buffer.append(simpleName); - buffer.append(">, "/*nonNLS*/); + buffer.append(">, "); switch(matchMode){ case EXACT_MATCH : - buffer.append("exact match, "/*nonNLS*/); + buffer.append("exact match, "); break; case PREFIX_MATCH : - buffer.append("prefix match, "/*nonNLS*/); + buffer.append("prefix match, "); break; case PATTERN_MATCH : - buffer.append("pattern match, "/*nonNLS*/); + buffer.append("pattern match, "); break; } if (isCaseSensitive) - buffer.append("case sensitive"/*nonNLS*/); + buffer.append("case sensitive"); else - buffer.append("case insensitive"/*nonNLS*/); + buffer.append("case insensitive"); return buffer.toString(); } - -/** - * @see SearchPattern#matchLevel(AstNode, boolean) - */ -public int matchLevel(AstNode node, boolean resolve) { - if (node instanceof TypeReference) { - return this.matchLevel((TypeReference)node, resolve); - } else if (node instanceof NameReference) { - return this.matchLevel((NameReference)node, resolve); - } else if (node instanceof ImportReference) { - return this.matchLevel((ImportReference)node, resolve); - } - return IMPOSSIBLE_MATCH; -} - -/** - * Returns whether this type pattern matches the given import reference. - * Look at resolved information only if specified. - */ -private int matchLevel(ImportReference importRef, boolean resolve) { - - if (importRef.onDemand) return IMPOSSIBLE_MATCH; - - char[][] tokens = importRef.tokens; - int importLength = tokens.length; - - if (this.qualification != null){ - char[][] qualificationTokens = CharOperation.splitOn('.', this.qualification); - int qualificationLength = qualificationTokens.length; - if (qualificationLength+1 > importLength) return IMPOSSIBLE_MATCH; - for (int i = 0; i < qualificationLength; i++){ - if (!this.matchesName(qualificationTokens[i], tokens[i])) { - return IMPOSSIBLE_MATCH; - } - } - if (this.simpleName == null || this.matchesName(this.simpleName, tokens[qualificationLength])) { - return ACCURATE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - } else { - if (this.simpleName == null) { - return ACCURATE_MATCH; - } else { - for (int i = 0; i < importLength; i++){ - if (this.matchesName(this.simpleName, tokens[i])){ - return ACCURATE_MATCH; - } - } - return IMPOSSIBLE_MATCH; - } - } -} - -/** - * Returns whether this type pattern matches the given name reference. - * Look at resolved information only if specified. - */ -private int matchLevel(NameReference nameRef, boolean resolve) { - if (!resolve) { - if (this.simpleName == null) { - return POSSIBLE_MATCH; - } else { - if (nameRef instanceof SingleNameReference) { - if (this.matchesName(this.simpleName, ((SingleNameReference)nameRef).token)) { - return POSSIBLE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - } else { // QualifiedNameReference - char[][] tokens = ((QualifiedNameReference)nameRef).tokens; - for (int i = 0, max = tokens.length; i < max; i++){ - if (this.matchesName(this.simpleName, tokens[i])) - return POSSIBLE_MATCH; - } - return IMPOSSIBLE_MATCH; - } - } - } else { - Binding binding = nameRef.binding; - if (binding == null) { - return INACCURATE_MATCH; - } else { - if (nameRef instanceof SingleNameReference) { - if (binding instanceof TypeBinding) { - return this.matchLevelForType(this.simpleName, this.qualification, (TypeBinding) binding); - } else { - return IMPOSSIBLE_MATCH; // must be a type binding - } - } else { // QualifiedNameReference - TypeBinding typeBinding = null; - QualifiedNameReference qNameRef = (QualifiedNameReference)nameRef; - char[][] tokens = qNameRef.tokens; - int lastIndex = tokens.length-1; - switch (qNameRef.bits & Statement.RestrictiveFlagMASK) { - case BindingIds.FIELD : // reading a field - typeBinding = ((FieldBinding)binding).declaringClass; - // no valid match amongst fields - int otherBindingsCount = qNameRef.otherBindings == null ? 0 : qNameRef.otherBindings.length; - lastIndex -= otherBindingsCount + 1; - if (lastIndex < 0) return IMPOSSIBLE_MATCH; - break; - case BindingIds.LOCAL : // reading a local variable - return IMPOSSIBLE_MATCH; // no type match in it - case BindingIds.TYPE : //=============only type ============== - typeBinding = (TypeBinding)binding; - } - // try to match all enclosing types for which the token matches as well. - while (typeBinding != null && lastIndex >= 0){ - if (this.matchesName(this.simpleName, tokens[lastIndex--])) { - int level = this.matchLevelForType(this.simpleName, this.qualification, typeBinding); - if (level != IMPOSSIBLE_MATCH) { - return level; - } - } - if (typeBinding instanceof ReferenceBinding){ - typeBinding = ((ReferenceBinding)typeBinding).enclosingType(); - } else { - typeBinding = null; - } - } - return IMPOSSIBLE_MATCH; - } - } - } -} - -/** - * Returns whether this type pattern matches the given type reference. - * Look at resolved information only if specified. - */ -private int matchLevel(TypeReference typeRef, boolean resolve) { - if (!resolve) { - if (this.simpleName == null) { - return POSSIBLE_MATCH; - } else { - if (typeRef instanceof SingleTypeReference) { - if (this.matchesName(this.simpleName, ((SingleTypeReference)typeRef).token)) { - return POSSIBLE_MATCH; - } else { - return IMPOSSIBLE_MATCH; - } - } else { // QualifiedTypeReference - char[][] tokens = ((QualifiedTypeReference)typeRef).tokens; - for (int i = 0, max = tokens.length; i < max; i++){ - if (this.matchesName(this.simpleName, tokens[i])) { - return POSSIBLE_MATCH; - } - } - return IMPOSSIBLE_MATCH; - } - } - } else { - TypeBinding typeBinding = typeRef.binding; - if (typeBinding == null) { - return INACCURATE_MATCH; - } else { - if (typeBinding instanceof ArrayBinding) typeBinding = ((ArrayBinding)typeBinding).leafComponentType; - if (typeRef instanceof SingleTypeReference){ - return this.matchLevelForType(this.simpleName, this.qualification, typeBinding); - } else { // QualifiedTypeReference - QualifiedTypeReference qNameRef = (QualifiedTypeReference)typeRef; - char[][] tokens = qNameRef.tokens; - int lastIndex = tokens.length-1; - // try to match all enclosing types for which the token matches as well. - while (typeBinding != null && lastIndex >= 0){ - if (matchesName(this.simpleName, tokens[lastIndex--])) { - int level = this.matchLevelForType(this.simpleName, this.qualification, typeBinding); - if (level != IMPOSSIBLE_MATCH) { - return level; - } - } - if (typeBinding instanceof ReferenceBinding){ - typeBinding = ((ReferenceBinding)typeBinding).enclosingType(); - } else { - typeBinding = null; - } - } - return IMPOSSIBLE_MATCH; - } - } - - } -} - -/** - * @see SearchPattern#matchLevel(Binding) - */ -public int matchLevel(Binding binding) { - if (binding == null) return INACCURATE_MATCH; - if (!(binding instanceof ReferenceBinding)) return IMPOSSIBLE_MATCH; - - ReferenceBinding type = (ReferenceBinding) binding; - int level = this.matchLevelForType(this.simpleName, this.qualification, type.superclass()); - if (level != IMPOSSIBLE_MATCH) { - return level; - } - - ReferenceBinding[] superInterfaces = type.superInterfaces(); - for (int i = 0, max = superInterfaces.length; i < max; i++){ - int newLevel = this.matchLevelForType(this.simpleName, this.qualification, superInterfaces[i]); - switch (newLevel) { - case IMPOSSIBLE_MATCH: - return IMPOSSIBLE_MATCH; - case ACCURATE_MATCH: // keep previous level - break; - default: // ie. INACCURATE_MATCH - level = newLevel; - break; - } - } - return level; -} }
diff --git a/search/org/eclipse/jdt/internal/core/search/processing/IJob.java b/search/org/eclipse/jdt/internal/core/search/processing/IJob.java index b7e9a7f..4618bea 100644 --- a/search/org/eclipse/jdt/internal/core/search/processing/IJob.java +++ b/search/org/eclipse/jdt/internal/core/search/processing/IJob.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.search.processing; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public interface IJob { /** @@ -12,8 +7,8 @@ public boolean belongsTo(String jobFamily); /** * Execute the current job, answering: - * RESCHEDULE if the job should be rescheduled later on - * COMPLETE if the job is over + * RESCHEDULE if the job should be rescheduled later on + * COMPLETE if the job is over */ public boolean execute(); }
diff --git a/search/org/eclipse/jdt/internal/core/search/processing/IJobConstants.java b/search/org/eclipse/jdt/internal/core/search/processing/IJobConstants.java index ffcdf9a..27d8d59 100644 --- a/search/org/eclipse/jdt/internal/core/search/processing/IJobConstants.java +++ b/search/org/eclipse/jdt/internal/core/search/processing/IJobConstants.java
@@ -1,9 +1,4 @@ package org.eclipse.jdt.internal.core.search.processing; -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -import org.eclipse.jdt.core.*; public interface IJobConstants { @@ -12,5 +7,5 @@ int WaitUntilReady = 3; boolean FAILED = false; - boolean COMPLETE = true; + boolean COMPLETE = true; }
diff --git a/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java b/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java index c6d4dd3..ff26886 100644 --- a/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java +++ b/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java
@@ -6,7 +6,6 @@ */ import org.eclipse.core.runtime.*; -import org.eclipse.jdt.internal.core.search.Util; import java.io.*; import java.util.*; @@ -25,25 +24,16 @@ private boolean enabled = true; public static boolean VERBOSE = false; - /* flag indicating that the activation has completed */ - public boolean activated = false; - /** * Invoked exactly once, in background, before starting processing any job */ -public void activateProcessing(){ - this.activated = true; -} +public abstract void activateProcessing(); /** * Answer the amount of awaiting jobs. */ public synchronized int awaitingJobsCount() { - // pretend busy in case concurrent job attempts performing before activated - if(!activated) return 1; - return jobEnd - jobStart + 1; - } /** * Answers the first job in the queue, or null if there is no job available @@ -137,24 +127,24 @@ */ public boolean performConcurrentJob(IJob searchJob, int waitingPolicy, IProgressMonitor progress) { - if (VERBOSE) System.out.println("-> performing concurrent job : START - "/*nonNLS*/ + searchJob); + if (VERBOSE) System.out.println("-> performing concurrent job : START - "+ searchJob); boolean status = FAILED; if (awaitingJobsCount() > 0){ switch(waitingPolicy){ case ForceImmediate : - if (VERBOSE) System.out.println("-> performing concurrent job : NOT READY - ForceImmediate - "/*nonNLS*/ + searchJob); + if (VERBOSE) System.out.println("-> performing concurrent job : NOT READY - ForceImmediate - "+ searchJob); boolean wasEnabled = isEnabled(); try { disable(); // pause indexing status = searchJob.execute(); - if (VERBOSE) System.out.println("-> performing concurrent job : END - "/*nonNLS*/ + searchJob); + if (VERBOSE) System.out.println("-> performing concurrent job : END - "+ searchJob); } finally { if (wasEnabled) enable(); } return status; case CancelIfNotReady : - if (VERBOSE) System.out.println("-> performing concurrent job : NOT READY - CancelIfNotReady - "/*nonNLS*/ + searchJob); + if (VERBOSE) System.out.println("-> performing concurrent job : NOT READY - CancelIfNotReady - "+ searchJob); progress.setCanceled(true); break; @@ -166,9 +156,9 @@ if (progress != null && progress.isCanceled()) throw new OperationCanceledException(); currentJob = currentJob(); // currentJob can be null when jobs have been added to the queue but job manager is not enabled if (currentJob != null && currentJob != previousJob){ - if (VERBOSE) System.out.println("-> performing concurrent job : NOT READY - WaitUntilReady - "/*nonNLS*/ + searchJob); + if (VERBOSE) System.out.println("-> performing concurrent job : NOT READY - WaitUntilReady - "+ searchJob); if (progress != null){ - progress.subTask(Util.bind("manager.filesToIndex"/*nonNLS*/, Integer.toString(awaitingWork))); + progress.subTask(awaitingWork+" files to index"); } previousJob = currentJob; } @@ -180,7 +170,7 @@ } } status = searchJob.execute(); - if (VERBOSE) System.out.println("-> performing concurrent job : END - "/*nonNLS*/ + searchJob); + if (VERBOSE) System.out.println("-> performing concurrent job : END - "+ searchJob); return status; } public abstract String processName(); @@ -194,7 +184,7 @@ jobStart = 0; } awaitingJobs[jobEnd] = job; - if (VERBOSE) System.out.println("-> requesting job: "/*nonNLS*/ + job); + if (VERBOSE) System.out.println("-> requesting job: "+job); } /** @@ -230,8 +220,8 @@ idlingStart = -1; } if (VERBOSE){ - System.out.println("-> executing: "/*nonNLS*/ + job); - System.out.println("\t"/*nonNLS*/ + awaitingJobsCount() + " awaiting jobs."/*nonNLS*/); + System.out.println("-> executing: "+job); + System.out.println("\t"+awaitingJobsCount()+" awaiting jobs."); } try { executing = true;