From 1f1efd8a452bc13dc160ead0b7061b8e72e2bdef Mon Sep 17 00:00:00 2001 From: incastrix Date: Tue, 13 Oct 2009 22:33:52 +0000 Subject: [PATCH] Refactory: remove unused classes, imports, fields and methods. --- .../phpdt/internal/compiler/CompilationResult.java | 56 ++-- .../internal/compiler/ConfigurableOption.java | 20 +- .../internal/compiler/DocumentElementParser.java | 32 +- .../internal/compiler/SourceElementParser.java | 178 ++++++------ .../compiler/batch/ClasspathDirectory.java | 2 +- .../phpdt/internal/compiler/batch/FileFinder.java | 61 ---- .../phpdt/internal/compiler/batch/FileSystem.java | 158 ++++++------ .../internal/compiler/batch/SuffixConstants.java | 54 ++++ .../phpdt/internal/compiler/codegen/Label.java | 20 +- .../compiler/env/NameEnvironmentAnswer.java | 6 +- .../phpdt/internal/compiler/flow/FlowContext.java | 270 +++++++++--------- .../compiler/flow/InsideSubRoutineFlowContext.java | 6 +- .../internal/compiler/flow/LoopingFlowContext.java | 46 ++-- .../internal/compiler/flow/SwitchFlowContext.java | 34 ++-- .../compiler/flow/UnconditionalFlowInfo.java | 22 +- .../internal/compiler/impl/CompilerOptions.java | 288 ++++++++++---------- .../compiler/lookup/CompilationUnitScope.java | 2 +- .../compiler/lookup/CompoundNameVector.java | 84 ++++++ .../phpdt/internal/compiler/parser/Parser.java | 70 +++--- .../phpdt/internal/compiler/parser/ParserUtil.java | 53 ---- .../internal/compiler/parser/RecoveredElement.java | 100 ++++---- .../phpdt/internal/compiler/parser/Scanner.java | 56 ++-- .../internal/compiler/parser/SyntaxError.java | 11 +- .../phpdt/internal/compiler/parser/UnitParser.java | 232 ++++++++-------- .../compiler/problem/AbortCompilation.java | 5 + .../compiler/problem/AbortCompilationUnit.java | 5 + .../internal/compiler/problem/AbortMethod.java | 5 + .../phpdt/internal/compiler/problem/AbortType.java | 5 + .../internal/compiler/problem/DefaultProblem.java | 98 ++++---- .../compiler/problem/DefaultProblemFactory.java | 6 +- .../internal/compiler/problem/ProblemReporter.java | 14 +- .../compiler/problem/ShouldNotImplement.java | 9 +- .../internal/compiler/util/CompoundNameVector.java | 84 ------ .../internal/compiler/util/HashtableOfInt.java | 110 -------- .../compiler/util/HashtableOfIntValues.java | 156 ----------- .../internal/compiler/util/HashtableOfLong.java | 110 -------- .../internal/compiler/util/SuffixConstants.java | 54 ---- 37 files changed, 1031 insertions(+), 1491 deletions(-) delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileFinder.java create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/SuffixConstants.java create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompoundNameVector.java delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/ParserUtil.java delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/CompoundNameVector.java delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfInt.java delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfIntValues.java delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfLong.java delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/SuffixConstants.java diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/CompilationResult.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/CompilationResult.java index 4d0704c..bb11974 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/CompilationResult.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/CompilationResult.java @@ -94,7 +94,7 @@ public class CompilationResult { private int computePriority(IProblem problem) { - final int P_STATIC = 1000; + //final int P_STATIC = 1000; final int P_OUTSIDE_METHOD = 4000; final int P_FIRST_ERROR = 2000; final int P_ERROR = 10000; @@ -283,20 +283,20 @@ public class CompilationResult { return this.tasks; } - public boolean hasErrors() { - - if (problems != null) - for (int i = 0; i < problemCount; i++) { - if (problems[i].isError()) - return true; - } - return false; - } - - public boolean hasProblems() { - - return problemCount != 0; - } +// public boolean hasErrors() { +// +// if (problems != null) +// for (int i = 0; i < problemCount; i++) { +// if (problems[i].isError()) +// return true; +// } +// return false; +// } + +// public boolean hasProblems() { +// +// return problemCount != 0; +// } public boolean hasSyntaxError() { @@ -310,19 +310,19 @@ public class CompilationResult { return false; } - public boolean hasTasks() { - return this.taskCount != 0; - } - - public boolean hasWarnings() { - - if (problems != null) - for (int i = 0; i < problemCount; i++) { - if (problems[i].isWarning()) - return true; - } - return false; - } +// public boolean hasTasks() { +// return this.taskCount != 0; +// } + +// public boolean hasWarnings() { +// +// if (problems != null) +// for (int i = 0; i < problemCount; i++) { +// if (problems[i].isWarning()) +// return true; +// } +// return false; +// } private static void quickSort(IProblem[] list, int left, int right) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ConfigurableOption.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ConfigurableOption.java index e9b77f2..7995af4 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ConfigurableOption.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ConfigurableOption.java @@ -38,7 +38,7 @@ public class ConfigurableOption { private int currentValueIndex; - private int defaultValueIndex; + //private int defaultValueIndex; private String[] possibleValues; @@ -163,9 +163,9 @@ public class ConfigurableOption { * * @return int */ - public int getDefaultValueIndex() { - return defaultValueIndex; - } +// public int getDefaultValueIndex() { +// return defaultValueIndex; +// } /** * Return an String that represents the localized description of the @@ -202,9 +202,9 @@ public class ConfigurableOption { * * @return java.lang.String[] */ - public String[] getPossibleValues() { - return possibleValues; - } +// public String[] getPossibleValues() { +// return possibleValues; +// } /** * Change the index (in possibleValues array) of the current setting for @@ -215,9 +215,9 @@ public class ConfigurableOption { * * @return int */ - public void setValueIndex(int newIndex) { - currentValueIndex = newIndex; - } +// public void setValueIndex(int newIndex) { +// currentValueIndex = newIndex; +// } public String toString() { StringBuffer buffer = new StringBuffer(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java index 82b66c3..dfc0471 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java @@ -1242,19 +1242,19 @@ public class DocumentElementParser extends UnitParser { return problemReporter; } - protected void pushOnIntArrayStack(int[] positions) { - - try { - intArrayStack[++intArrayPtr] = positions; - } catch (IndexOutOfBoundsException e) { - // intPtr is correct - int oldStackLength = intArrayStack.length; - int oldStack[][] = intArrayStack; - intArrayStack = new int[oldStackLength + StackIncrement][]; - System.arraycopy(oldStack, 0, intArrayStack, 0, oldStackLength); - intArrayStack[intArrayPtr] = positions; - } - } +// protected void pushOnIntArrayStack(int[] positions) { +// +// try { +// intArrayStack[++intArrayPtr] = positions; +// } catch (IndexOutOfBoundsException e) { +// // intPtr is correct +// int oldStackLength = intArrayStack.length; +// int oldStack[][] = intArrayStack; +// intArrayStack = new int[oldStackLength + StackIncrement][]; +// System.arraycopy(oldStack, 0, intArrayStack, 0, oldStackLength); +// intArrayStack[intArrayPtr] = positions; +// } +// } // protected void resetModifiers() { // super.resetModifiers(); @@ -1264,9 +1264,9 @@ public class DocumentElementParser extends UnitParser { * Syntax error was detected. Will attempt to perform some recovery action * in order to resume to the regular parse loop. */ - protected boolean resumeOnSyntaxError() { - return false; - } +// protected boolean resumeOnSyntaxError() { +// return false; +// } /* * Answer a char array representation of the type name formatted like: - * type name + dimensions Example: "A[][]".toCharArray() diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java index b0b8081..74b4c09 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java @@ -132,19 +132,19 @@ public class SourceElementParser extends CommentRecorderParser {// extends * @deprecated use SourceElementParser(ISourceElementRequestor, * IProblemFactory, CompilerOptions) */ - public SourceElementParser(final ISourceElementRequestor requestor, - IProblemFactory problemFactory) { - this(requestor, problemFactory, new CompilerOptions()); - } +// public SourceElementParser(final ISourceElementRequestor requestor, +// IProblemFactory problemFactory) { +// this(requestor, problemFactory, new CompilerOptions()); +// } - public SourceElementParser(final ISourceElementRequestor requestor, - IProblemFactory problemFactory, CompilerOptions options, - boolean reportLocalDeclarations) { - this(requestor, problemFactory, options); - if (reportLocalDeclarations) { - this.localDeclarationVisitor = new LocalDeclarationVisitor(); - } - } +// public SourceElementParser(final ISourceElementRequestor requestor, +// IProblemFactory problemFactory, CompilerOptions options, +// boolean reportLocalDeclarations) { +// this(requestor, problemFactory, options); +// if (reportLocalDeclarations) { +// this.localDeclarationVisitor = new LocalDeclarationVisitor(); +// } +// } // public void checkAnnotation() { // int firstCommentIndex = scanner.commentPtr; @@ -1132,36 +1132,36 @@ public class SourceElementParser extends CommentRecorderParser {// extends } } - public void parseCompilationUnit(ICompilationUnit unit, int start, int end) { - // boolean needReferenceInfo) { - - // reportReferenceInfo = needReferenceInfo; - // boolean old = diet; - // if (needReferenceInfo) { - // unknownRefs = new NameReference[10]; - // unknownRefsCounter = 0; - // } - - try { - // diet = true; -// CompilationResult compilationUnitResult = new CompilationResult( -// unit, 0, 0, 10); // this.options.maxProblemsPerUnit); -// CompilationUnitDeclaration parsedUnit = parse(unit, -// compilationUnitResult, start, end); - // if (scanner.recordLineSeparator) { - // requestor.acceptLineSeparatorPositions(scanner.getLineEnds()); - // } - // if (this.localDeclarationVisitor != null || needReferenceInfo){ - // diet = false; - // this.getMethodBodies(parsedUnit); - // } - // this.scanner.resetTo(start, end); - // notifySourceElementRequestor(parsedUnit); - } catch (AbortCompilation e) { - } finally { - // diet = old; - } - } +// public void parseCompilationUnit(ICompilationUnit unit, int start, int end) { +// // boolean needReferenceInfo) { +// +// // reportReferenceInfo = needReferenceInfo; +// // boolean old = diet; +// // if (needReferenceInfo) { +// // unknownRefs = new NameReference[10]; +// // unknownRefsCounter = 0; +// // } +// +// try { +// // diet = true; +//// CompilationResult compilationUnitResult = new CompilationResult( +//// unit, 0, 0, 10); // this.options.maxProblemsPerUnit); +//// CompilationUnitDeclaration parsedUnit = parse(unit, +//// compilationUnitResult, start, end); +// // if (scanner.recordLineSeparator) { +// // requestor.acceptLineSeparatorPositions(scanner.getLineEnds()); +// // } +// // if (this.localDeclarationVisitor != null || needReferenceInfo){ +// // diet = false; +// // this.getMethodBodies(parsedUnit); +// // } +// // this.scanner.resetTo(start, end); +// // notifySourceElementRequestor(parsedUnit); +// } catch (AbortCompilation e) { +// } finally { +// // diet = old; +// } +// } public CompilationUnitDeclaration parseCompilationUnit( ICompilationUnit unit, boolean fullParse) { @@ -1199,41 +1199,41 @@ public class SourceElementParser extends CommentRecorderParser {// extends return null; } - public CompilationUnitDeclaration parseCompletionUnit( - ICompilationUnit unit, boolean fullParse) { - - // boolean old = diet; - // if (fullParse) { - // unknownRefs = new NameReference[10]; - // unknownRefsCounter = 0; - // } - - try { - // diet = true; - this.reportReferenceInfo = fullParse; - CompilationResult compilationUnitResult = new CompilationResult( - unit, 0, 0, this.options.maxProblemsPerUnit); - CompilationUnitDeclaration parsedUnit = parse(unit, - compilationUnitResult, false); - // if (scanner.recordLineSeparator) { - // requestor.acceptLineSeparatorPositions(scanner.getLineEnds()); - // } - // int initialStart = this.scanner.initialPosition; - // int initialEnd = this.scanner.eofPosition; - // // if (this.localDeclarationVisitor != null || fullParse){ - // // diet = false; - // // this.getMethodBodies(parsedUnit); - // // } - // this.scanner.resetTo(initialStart, initialEnd); - // notifySourceElementRequestor(parsedUnit); - return parsedUnit; - } catch (AbortCompilation e) { - // ignore this exception - } finally { - // diet = old; - } - return null; - } +// public CompilationUnitDeclaration parseCompletionUnit( +// ICompilationUnit unit, boolean fullParse) { +// +// // boolean old = diet; +// // if (fullParse) { +// // unknownRefs = new NameReference[10]; +// // unknownRefsCounter = 0; +// // } +// +// try { +// // diet = true; +// this.reportReferenceInfo = fullParse; +// CompilationResult compilationUnitResult = new CompilationResult( +// unit, 0, 0, this.options.maxProblemsPerUnit); +// CompilationUnitDeclaration parsedUnit = parse(unit, +// compilationUnitResult, false); +// // if (scanner.recordLineSeparator) { +// // requestor.acceptLineSeparatorPositions(scanner.getLineEnds()); +// // } +// // int initialStart = this.scanner.initialPosition; +// // int initialEnd = this.scanner.eofPosition; +// // // if (this.localDeclarationVisitor != null || fullParse){ +// // // diet = false; +// // // this.getMethodBodies(parsedUnit); +// // // } +// // this.scanner.resetTo(initialStart, initialEnd); +// // notifySourceElementRequestor(parsedUnit); +// return parsedUnit; +// } catch (AbortCompilation e) { +// // ignore this exception +// } finally { +// // diet = old; +// } +// return null; +// } // public void parseTypeMemberDeclarations( // ISourceType sourceType, @@ -1376,18 +1376,18 @@ public class SourceElementParser extends CommentRecorderParser {// extends return CharOperation.concatWith(type.getTypeName(), '.'); } - public void addUnknownRef(NameReference nameRef) { - if (this.unknownRefs.length == this.unknownRefsCounter) { - // resize - System - .arraycopy( - this.unknownRefs, - 0, - (this.unknownRefs = new NameReference[this.unknownRefsCounter * 2]), - 0, this.unknownRefsCounter); - } - this.unknownRefs[this.unknownRefsCounter++] = nameRef; - } +// public void addUnknownRef(NameReference nameRef) { +// if (this.unknownRefs.length == this.unknownRefsCounter) { +// // resize +// System +// .arraycopy( +// this.unknownRefs, +// 0, +// (this.unknownRefs = new NameReference[this.unknownRefsCounter * 2]), +// 0, this.unknownRefsCounter); +// } +// this.unknownRefs[this.unknownRefsCounter++] = nameRef; +// } private void visitIfNeeded(AbstractMethodDeclaration method) { if (this.localDeclarationVisitor != null diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/ClasspathDirectory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/ClasspathDirectory.java index ec61df9..eb7d223 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/ClasspathDirectory.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/ClasspathDirectory.java @@ -14,7 +14,7 @@ import java.io.File; import java.util.Hashtable; import net.sourceforge.phpdt.internal.compiler.env.NameEnvironmentAnswer; -import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants; +//import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants; public class ClasspathDirectory implements FileSystem.Classpath, SuffixConstants { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileFinder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileFinder.java deleted file mode 100644 index aa8ab54..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileFinder.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.compiler.batch; - -import java.io.File; - -public class FileFinder { - private static final int INITIAL_SIZE = 10; - - public String[] resultFiles = new String[INITIAL_SIZE]; - - public int count = 0; - - public void find(File f, String pattern, boolean verbose) { - if (verbose) { - // System.out.println(Main.bind("scanning.start",f.getAbsolutePath())); - // //$NON-NLS-1$ - } - find0(f, pattern, verbose); - System.arraycopy(this.resultFiles, 0, - (this.resultFiles = new String[this.count]), 0, this.count); - } - - public void find0(File f, String pattern, boolean verbose) { - if (f.isDirectory()) { - String[] files = f.list(); - if (files == null) - return; - for (int i = 0, max = files.length; i < max; i++) { - File current = new File(f, files[i]); - if (current.isDirectory()) { - find0(current, pattern, verbose); - } else { - if (current.getName().toUpperCase().endsWith(pattern)) { - int length; - if ((length = this.resultFiles.length) == this.count) { - System - .arraycopy( - this.resultFiles, - 0, - (this.resultFiles = new String[length * 2]), - 0, length); - } - this.resultFiles[this.count++] = current - .getAbsolutePath(); - if (verbose && (this.count % 100) == 0) - System.out.print('.'); - } - } - } - } - } -} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileSystem.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileSystem.java index 04b18d4..2495f23 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileSystem.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/FileSystem.java @@ -15,7 +15,7 @@ import java.io.File; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment; import net.sourceforge.phpdt.internal.compiler.env.NameEnvironmentAnswer; -import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants; +//import net.sourceforge.phpdt.internal.compiler.util.SuffixConstants; public class FileSystem implements INameEnvironment, SuffixConstants { Classpath[] classpaths; @@ -41,91 +41,91 @@ public class FileSystem implements INameEnvironment, SuffixConstants { * '.java' will be removed if its not already. */ - public FileSystem(String[] classpathNames, String[] initialFileNames, - String encoding) { - this(classpathNames, initialFileNames, encoding, null); - } - - public FileSystem(String[] classpathNames, String[] initialFileNames, - String encoding, int[] classpathDirectoryModes) { - int classpathSize = classpathNames.length; - this.classpaths = new Classpath[classpathSize]; - String[] pathNames = new String[classpathSize]; - int problemsOccured = 0; - for (int i = 0; i < classpathSize; i++) { - // try { - File file = new File(convertPathSeparators(classpathNames[i])); - if (file.isDirectory()) { - if (file.exists()) { - if (classpathDirectoryModes == null) { - this.classpaths[i] = new ClasspathDirectory(file, - encoding); - } else { - this.classpaths[i] = new ClasspathDirectory(file, - encoding, classpathDirectoryModes[i]); - } - pathNames[i] = ((ClasspathDirectory) this.classpaths[i]).path; - } - } else { - //String lowercaseClasspathName = classpathNames[i].toLowerCase(); - // if (lowercaseClasspathName.endsWith(SUFFIX_STRING_jar) - // || lowercaseClasspathName.endsWith(SUFFIX_STRING_zip)) { - // this.classpaths[i] = this.getClasspathJar(file); // will - // throw an IOException if file does not exist - // pathNames[i] = classpathNames[i].substring(0, - // classpathNames[i].lastIndexOf('.')); - // } - } - // } catch (IOException e) { - // this.classpaths[i] = null; - // } - if (this.classpaths[i] == null) - problemsOccured++; - } - if (problemsOccured > 0) { - Classpath[] newPaths = new Classpath[classpathSize - - problemsOccured]; - String[] newNames = new String[classpathSize - problemsOccured]; - for (int i = 0, current = 0; i < classpathSize; i++) - if (this.classpaths[i] != null) { - newPaths[current] = this.classpaths[i]; - newNames[current++] = pathNames[i]; - } - classpathSize = newPaths.length; - this.classpaths = newPaths; - pathNames = newNames; - } - - this.knownFileNames = new String[initialFileNames.length]; - for (int i = initialFileNames.length; --i >= 0;) { - String fileName = initialFileNames[i]; - String matchingPathName = null; - if (fileName.lastIndexOf(".") != -1) //$NON-NLS-1$ - fileName = fileName.substring(0, fileName.lastIndexOf('.')); // remove - // trailing - // ".java" - - fileName = convertPathSeparators(fileName); - for (int j = 0; j < classpathSize; j++) - if (fileName.startsWith(pathNames[j])) - matchingPathName = pathNames[j]; - if (matchingPathName == null) - this.knownFileNames[i] = fileName; // leave as is... - else - this.knownFileNames[i] = fileName.substring(matchingPathName - .length()); - } - } +// public FileSystem(String[] classpathNames, String[] initialFileNames, +// String encoding) { +// this(classpathNames, initialFileNames, encoding, null); +// } + +// public FileSystem(String[] classpathNames, String[] initialFileNames, +// String encoding, int[] classpathDirectoryModes) { +// int classpathSize = classpathNames.length; +// this.classpaths = new Classpath[classpathSize]; +// String[] pathNames = new String[classpathSize]; +// int problemsOccured = 0; +// for (int i = 0; i < classpathSize; i++) { +// // try { +// File file = new File(convertPathSeparators(classpathNames[i])); +// if (file.isDirectory()) { +// if (file.exists()) { +// if (classpathDirectoryModes == null) { +// this.classpaths[i] = new ClasspathDirectory(file, +// encoding); +// } else { +// this.classpaths[i] = new ClasspathDirectory(file, +// encoding, classpathDirectoryModes[i]); +// } +// pathNames[i] = ((ClasspathDirectory) this.classpaths[i]).path; +// } +// } else { +// //String lowercaseClasspathName = classpathNames[i].toLowerCase(); +// // if (lowercaseClasspathName.endsWith(SUFFIX_STRING_jar) +// // || lowercaseClasspathName.endsWith(SUFFIX_STRING_zip)) { +// // this.classpaths[i] = this.getClasspathJar(file); // will +// // throw an IOException if file does not exist +// // pathNames[i] = classpathNames[i].substring(0, +// // classpathNames[i].lastIndexOf('.')); +// // } +// } +// // } catch (IOException e) { +// // this.classpaths[i] = null; +// // } +// if (this.classpaths[i] == null) +// problemsOccured++; +// } +// if (problemsOccured > 0) { +// Classpath[] newPaths = new Classpath[classpathSize +// - problemsOccured]; +// String[] newNames = new String[classpathSize - problemsOccured]; +// for (int i = 0, current = 0; i < classpathSize; i++) +// if (this.classpaths[i] != null) { +// newPaths[current] = this.classpaths[i]; +// newNames[current++] = pathNames[i]; +// } +// classpathSize = newPaths.length; +// this.classpaths = newPaths; +// pathNames = newNames; +// } +// +// this.knownFileNames = new String[initialFileNames.length]; +// for (int i = initialFileNames.length; --i >= 0;) { +// String fileName = initialFileNames[i]; +// String matchingPathName = null; +// if (fileName.lastIndexOf(".") != -1) //$NON-NLS-1$ +// fileName = fileName.substring(0, fileName.lastIndexOf('.')); // remove +// // trailing +// // ".java" +// +// fileName = convertPathSeparators(fileName); +// for (int j = 0; j < classpathSize; j++) +// if (fileName.startsWith(pathNames[j])) +// matchingPathName = pathNames[j]; +// if (matchingPathName == null) +// this.knownFileNames[i] = fileName; // leave as is... +// else +// this.knownFileNames[i] = fileName.substring(matchingPathName +// .length()); +// } +// } public void cleanup() { for (int i = 0, max = this.classpaths.length; i < max; i++) this.classpaths[i].reset(); } - private String convertPathSeparators(String path) { - return File.separatorChar == '/' ? path.replace('\\', '/') : path - .replace('/', '\\'); - } +// private String convertPathSeparators(String path) { +// return File.separatorChar == '/' ? path.replace('\\', '/') : path +// .replace('/', '\\'); +// } // private NameEnvironmentAnswer findClass(String qualifiedTypeName, char[] // typeName){ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/SuffixConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/SuffixConstants.java new file mode 100644 index 0000000..a8c79a1 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/batch/SuffixConstants.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.compiler.batch; + +public interface SuffixConstants { + // public final static String EXTENSION_class = "class"; //$NON-NLS-1$ + // public final static String EXTENSION_CLASS = "CLASS"; //$NON-NLS-1$ + public final static String EXTENSION_php = "php"; //$NON-NLS-1$ + + public final static String EXTENSION_PHP = "PHP"; //$NON-NLS-1$ + + // public final static String SUFFIX_STRING_class = "." + EXTENSION_class; + // //$NON-NLS-1$ + // public final static String SUFFIX_STRING_CLASS = "." + EXTENSION_CLASS; + // //$NON-NLS-1$ + public final static String SUFFIX_STRING_php = "." + EXTENSION_php; //$NON-NLS-1$ + + public final static String SUFFIX_STRING_PHP = "." + EXTENSION_PHP; //$NON-NLS-1$ + + // public final static char[] SUFFIX_class = + // SUFFIX_STRING_class.toCharArray(); + // public final static char[] SUFFIX_CLASS = + // SUFFIX_STRING_CLASS.toCharArray(); + public final static char[] SUFFIX_php = SUFFIX_STRING_php.toCharArray(); + + public final static char[] SUFFIX_PHP = SUFFIX_STRING_PHP.toCharArray(); + + // public final static String EXTENSION_jar = "jar"; //$NON-NLS-1$ + // public final static String EXTENSION_JAR = "JAR"; //$NON-NLS-1$ + // public final static String EXTENSION_zip = "zip"; //$NON-NLS-1$ + // public final static String EXTENSION_ZIP = "ZIP"; //$NON-NLS-1$ + + // public final static String SUFFIX_STRING_jar = "." + EXTENSION_jar; + // //$NON-NLS-1$ + // public final static String SUFFIX_STRING_JAR = "." + EXTENSION_JAR; + // //$NON-NLS-1$ + // public final static String SUFFIX_STRING_zip = "." + EXTENSION_zip; + // //$NON-NLS-1$ + // public final static String SUFFIX_STRING_ZIP = "." + EXTENSION_ZIP; + // //$NON-NLS-1$ + + // public final static char[] SUFFIX_jar = SUFFIX_STRING_jar.toCharArray(); + // public final static char[] SUFFIX_JAR = SUFFIX_STRING_JAR.toCharArray(); + // public final static char[] SUFFIX_zip = SUFFIX_STRING_zip.toCharArray(); + // public final static char[] SUFFIX_ZIP = SUFFIX_STRING_ZIP.toCharArray(); +} \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/codegen/Label.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/codegen/Label.java index 3e09f1c..01c898b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/codegen/Label.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/codegen/Label.java @@ -40,13 +40,13 @@ public class Label { /** * Add a forward refrence for the array. */ - void addForwardReference(int iPos) { - int length; - if (forwardReferenceCount >= (length = forwardReferences.length)) - System.arraycopy(forwardReferences, 0, - (forwardReferences = new int[2 * length]), 0, length); - forwardReferences[forwardReferenceCount++] = iPos; - } +// void addForwardReference(int iPos) { +// int length; +// if (forwardReferenceCount >= (length = forwardReferences.length)) +// System.arraycopy(forwardReferences, 0, +// (forwardReferences = new int[2 * length]), 0, length); +// forwardReferences[forwardReferenceCount++] = iPos; +// } /** * Add a forward refrence for the array. @@ -144,9 +144,9 @@ public class Label { // } // } // } - public boolean isStandardLabel() { - return true; - } +// public boolean isStandardLabel() { +// return true; +// } /* * Place the label. If we have forward references resolve them. diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/env/NameEnvironmentAnswer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/env/NameEnvironmentAnswer.java index 38cecaf..0927669 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/env/NameEnvironmentAnswer.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/env/NameEnvironmentAnswer.java @@ -19,9 +19,9 @@ public class NameEnvironmentAnswer { ISourceType[] sourceTypes; - public NameEnvironmentAnswer(IBinaryType binaryType) { - this.binaryType = binaryType; - } +// public NameEnvironmentAnswer(IBinaryType binaryType) { +// this.binaryType = binaryType; +// } public NameEnvironmentAnswer(ICompilationUnit compilationUnit) { this.compilationUnit = compilationUnit; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowContext.java index 8daeeba..90a1f67 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowContext.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowContext.java @@ -10,12 +10,12 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.compiler.flow; -import net.sourceforge.phpdt.core.compiler.CharOperation; +//import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.compiler.ast.ASTNode; import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration; import net.sourceforge.phpdt.internal.compiler.ast.Reference; import net.sourceforge.phpdt.internal.compiler.ast.TryStatement; -import net.sourceforge.phpdt.internal.compiler.codegen.Label; +//import net.sourceforge.phpdt.internal.compiler.codegen.Label; import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope; import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding; import net.sourceforge.phpdt.internal.compiler.lookup.Scope; @@ -42,10 +42,10 @@ public class FlowContext implements TypeConstants { this.associatedNode = associatedNode; } - public Label breakLabel() { - - return null; - } +// public Label breakLabel() { +// +// return null; +// } public void checkExceptionHandlers(TypeBinding[] raisedExceptions, ASTNode location, FlowInfo flowInfo, BlockScope scope) { @@ -289,169 +289,169 @@ public class FlowContext implements TypeConstants { scope.problemReporter().unhandledException(raisedException, location); } - public Label continueLabel() { - - return null; - } +// public Label continueLabel() { +// +// return null; +// } /* * lookup through break labels */ - public FlowContext getTargetContextForBreakLabel(char[] labelName) { - - FlowContext current = this, lastNonReturningSubRoutine = null; - while (current != null) { - if (current.isNonReturningContext()) { - lastNonReturningSubRoutine = current; - } - char[] currentLabelName; - if (((currentLabelName = current.labelName()) != null) - && CharOperation.equals(currentLabelName, labelName)) { - if (lastNonReturningSubRoutine == null) { - return current; - } else { - return lastNonReturningSubRoutine; - } - } - current = current.parent; - } - // not found - return null; - } +// public FlowContext getTargetContextForBreakLabel(char[] labelName) { +// +// FlowContext current = this, lastNonReturningSubRoutine = null; +// while (current != null) { +// if (current.isNonReturningContext()) { +// lastNonReturningSubRoutine = current; +// } +// char[] currentLabelName; +// if (((currentLabelName = current.labelName()) != null) +// && CharOperation.equals(currentLabelName, labelName)) { +// if (lastNonReturningSubRoutine == null) { +// return current; +// } else { +// return lastNonReturningSubRoutine; +// } +// } +// current = current.parent; +// } +// // not found +// return null; +// } /* * lookup through continue labels */ - public FlowContext getTargetContextForContinueLabel(char[] labelName) { - - FlowContext current = this; - FlowContext lastContinuable = null; - FlowContext lastNonReturningSubRoutine = null; - - while (current != null) { - if (current.isNonReturningContext()) { - lastNonReturningSubRoutine = current; - } else { - if (current.isContinuable()) { - lastContinuable = current; - } - } - - char[] currentLabelName; - if ((currentLabelName = current.labelName()) != null - && CharOperation.equals(currentLabelName, labelName)) { - - // matching label found - if ((lastContinuable != null) - && (current.associatedNode.concreteStatement() == lastContinuable.associatedNode)) { - - if (lastNonReturningSubRoutine == null) { - return lastContinuable; - } else { - return lastNonReturningSubRoutine; - } - } else { - // label is found, but not a continuable location - return NotContinuableContext; - } - } - current = current.parent; - } - // not found - return null; - } +// public FlowContext getTargetContextForContinueLabel(char[] labelName) { +// +// FlowContext current = this; +// FlowContext lastContinuable = null; +// FlowContext lastNonReturningSubRoutine = null; +// +// while (current != null) { +// if (current.isNonReturningContext()) { +// lastNonReturningSubRoutine = current; +// } else { +// if (current.isContinuable()) { +// lastContinuable = current; +// } +// } +// +// char[] currentLabelName; +// if ((currentLabelName = current.labelName()) != null +// && CharOperation.equals(currentLabelName, labelName)) { +// +// // matching label found +// if ((lastContinuable != null) +// && (current.associatedNode.concreteStatement() == lastContinuable.associatedNode)) { +// +// if (lastNonReturningSubRoutine == null) { +// return lastContinuable; +// } else { +// return lastNonReturningSubRoutine; +// } +// } else { +// // label is found, but not a continuable location +// return NotContinuableContext; +// } +// } +// current = current.parent; +// } +// // not found +// return null; +// } /* * lookup a default break through breakable locations */ - public FlowContext getTargetContextForDefaultBreak() { - - FlowContext current = this, lastNonReturningSubRoutine = null; - while (current != null) { - if (current.isNonReturningContext()) { - lastNonReturningSubRoutine = current; - } - if (current.isBreakable() && current.labelName() == null) { - if (lastNonReturningSubRoutine == null) { - return current; - } else { - return lastNonReturningSubRoutine; - } - } - current = current.parent; - } - // not found - return null; - } +// public FlowContext getTargetContextForDefaultBreak() { +// +// FlowContext current = this, lastNonReturningSubRoutine = null; +// while (current != null) { +// if (current.isNonReturningContext()) { +// lastNonReturningSubRoutine = current; +// } +// if (current.isBreakable() && current.labelName() == null) { +// if (lastNonReturningSubRoutine == null) { +// return current; +// } else { +// return lastNonReturningSubRoutine; +// } +// } +// current = current.parent; +// } +// // not found +// return null; +// } /* * lookup a default continue amongst continuable locations */ - public FlowContext getTargetContextForDefaultContinue() { - - FlowContext current = this, lastNonReturningSubRoutine = null; - while (current != null) { - if (current.isNonReturningContext()) { - lastNonReturningSubRoutine = current; - } - if (current.isContinuable()) { - if (lastNonReturningSubRoutine == null) { - return current; - } else { - return lastNonReturningSubRoutine; - } - } - current = current.parent; - } - // not found - return null; - } +// public FlowContext getTargetContextForDefaultContinue() { +// +// FlowContext current = this, lastNonReturningSubRoutine = null; +// while (current != null) { +// if (current.isNonReturningContext()) { +// lastNonReturningSubRoutine = current; +// } +// if (current.isContinuable()) { +// if (lastNonReturningSubRoutine == null) { +// return current; +// } else { +// return lastNonReturningSubRoutine; +// } +// } +// current = current.parent; +// } +// // not found +// return null; +// } public String individualToString() { return "Flow context"; //$NON-NLS-1$ } - public FlowInfo initsOnBreak() { +// public FlowInfo initsOnBreak() { +// +// return FlowInfo.DEAD_END; +// } - return FlowInfo.DEAD_END; - } - - public UnconditionalFlowInfo initsOnReturn() { - - return FlowInfo.DEAD_END; - } - - public boolean isBreakable() { - - return false; - } +// public UnconditionalFlowInfo initsOnReturn() { +// +// return FlowInfo.DEAD_END; +// } - public boolean isContinuable() { +// public boolean isBreakable() { +// +// return false; +// } - return false; - } - - public boolean isNonReturningContext() { +// public boolean isContinuable() { +// +// return false; +// } - return false; - } +// public boolean isNonReturningContext() { +// +// return false; +// } - public boolean isSubRoutine() { - - return false; - } +// public boolean isSubRoutine() { +// +// return false; +// } public char[] labelName() { return null; } - public void recordBreakFrom(FlowInfo flowInfo) { - } +// public void recordBreakFrom(FlowInfo flowInfo) { +// } - public void recordContinueFrom(FlowInfo flowInfo) { - } +// public void recordContinueFrom(FlowInfo flowInfo) { +// } boolean recordFinalAssignment(VariableBinding variable, Reference finalReference) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InsideSubRoutineFlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InsideSubRoutineFlowContext.java index 592d957..bc3b10f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InsideSubRoutineFlowContext.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InsideSubRoutineFlowContext.java @@ -38,9 +38,9 @@ public class InsideSubRoutineFlowContext extends FlowContext { return this.initsOnReturn; } - public boolean isNonReturningContext() { - return associatedNode.cannotReturn(); - } +// public boolean isNonReturningContext() { +// return associatedNode.cannotReturn(); +// } public ASTNode subRoutine() { return associatedNode; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LoopingFlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LoopingFlowContext.java index c052e07..487809b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LoopingFlowContext.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LoopingFlowContext.java @@ -83,9 +83,9 @@ public class LoopingFlowContext extends SwitchFlowContext { } } - public Label continueLabel() { - return continueLabel; - } +// public Label continueLabel() { +// return continueLabel; +// } public String individualToString() { StringBuffer buffer = new StringBuffer("Looping flow context"); //$NON-NLS-1$ @@ -96,26 +96,26 @@ public class LoopingFlowContext extends SwitchFlowContext { return buffer.toString(); } - public boolean isContinuable() { - return true; - } - - public boolean isContinuedTo() { - return initsOnContinue != FlowInfo.DEAD_END; - } - - public void recordContinueFrom(FlowInfo flowInfo) { - - if (!flowInfo.isReachable()) - return; - if (initsOnContinue == FlowInfo.DEAD_END) { - initsOnContinue = flowInfo.copy().unconditionalInits(); - } else { - initsOnContinue = initsOnContinue.mergedWith(flowInfo - .unconditionalInits()); - } - ; - } +// public boolean isContinuable() { +// return true; +// } + +// public boolean isContinuedTo() { +// return initsOnContinue != FlowInfo.DEAD_END; +// } + +// public void recordContinueFrom(FlowInfo flowInfo) { +// +// if (!flowInfo.isReachable()) +// return; +// if (initsOnContinue == FlowInfo.DEAD_END) { +// initsOnContinue = flowInfo.copy().unconditionalInits(); +// } else { +// initsOnContinue = initsOnContinue.mergedWith(flowInfo +// .unconditionalInits()); +// } +// ; +// } boolean recordFinalAssignment(VariableBinding binding, Reference finalAssignment) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/SwitchFlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/SwitchFlowContext.java index 26a050d..c8501c8 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/SwitchFlowContext.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/SwitchFlowContext.java @@ -28,9 +28,9 @@ public class SwitchFlowContext extends FlowContext { this.breakLabel = breakLabel; } - public Label breakLabel() { - return breakLabel; - } +// public Label breakLabel() { +// return breakLabel; +// } public String individualToString() { StringBuffer buffer = new StringBuffer("Switch flow context"); //$NON-NLS-1$ @@ -39,18 +39,18 @@ public class SwitchFlowContext extends FlowContext { return buffer.toString(); } - public boolean isBreakable() { - return true; - } - - public void recordBreakFrom(FlowInfo flowInfo) { - - if (initsOnBreak == FlowInfo.DEAD_END) { - initsOnBreak = flowInfo.copy().unconditionalInits(); - } else { - initsOnBreak = initsOnBreak.mergedWith(flowInfo - .unconditionalInits()); - } - ; - } +// public boolean isBreakable() { +// return true; +// } + +// public void recordBreakFrom(FlowInfo flowInfo) { +// +// if (initsOnBreak == FlowInfo.DEAD_END) { +// initsOnBreak = flowInfo.copy().unconditionalInits(); +// } else { +// initsOnBreak = initsOnBreak.mergedWith(flowInfo +// .unconditionalInits()); +// } +// ; +// } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/UnconditionalFlowInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/UnconditionalFlowInfo.java index 6907f62..2ced1f8 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/UnconditionalFlowInfo.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/UnconditionalFlowInfo.java @@ -13,7 +13,7 @@ package net.sourceforge.phpdt.internal.compiler.flow; import net.sourceforge.phpdt.internal.compiler.impl.Constant; import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding; import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding; -import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding; +//import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding; /** * Record initialization status during definite assignment analysis @@ -572,16 +572,16 @@ public class UnconditionalFlowInfo extends FlowInfo { /* * Answer the total number of fields in enclosing types of a given type */ - static int numberOfEnclosingFields(ReferenceBinding type) { - - int count = 0; - type = type.enclosingType(); - while (type != null) { - count += type.fieldCount(); - type = type.enclosingType(); - } - return count; - } +// static int numberOfEnclosingFields(ReferenceBinding type) { +// +// int count = 0; +// type = type.enclosingType(); +// while (type != null) { +// count += type.fieldCount(); +// type = type.enclosingType(); +// } +// return count; +// } public int reachMode() { return this.reachMode; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java index 409f590..c9de5be 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java @@ -13,7 +13,7 @@ package net.sourceforge.phpdt.internal.compiler.impl; import java.io.ByteArrayInputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; -import java.util.HashMap; +//import java.util.HashMap; import java.util.Map; import net.sourceforge.phpdt.core.compiler.CharOperation; @@ -382,146 +382,146 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, set(settings); } - public Map getMap() { - Map optionsMap = new HashMap(30); - optionsMap.put(OPTION_PHPIncludeNotExistWarning, - getSeverityString(PHPIncludeNotExistWarning)); - optionsMap.put(OPTION_PHPVarDeprecatedWarning, - getSeverityString(PHPVarDeprecatedWarning)); - optionsMap.put(OPTION_PHPBadStyleKeywordWarning, - getSeverityString(PHPBadStyleKeywordWarning)); - optionsMap.put(OPTION_PHPBadStyleUppercaseIdentifierWarning, - getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); - optionsMap.put(OPTION_UninitializedLocalVariableWarning, - getSeverityString(UninitializedLocalVariableWarning)); - optionsMap.put(OPTION_CodeCannotBeReachedWarning, - getSeverityString(CodeCannotBeReachedWarning)); - - optionsMap.put(OPTION_LocalVariableAttribute, - (this.produceDebugAttributes & Vars) != 0 ? GENERATE - : DO_NOT_GENERATE); - optionsMap.put(OPTION_LineNumberAttribute, - (this.produceDebugAttributes & Lines) != 0 ? GENERATE - : DO_NOT_GENERATE); - optionsMap.put(OPTION_SourceFileAttribute, - (this.produceDebugAttributes & Source) != 0 ? GENERATE - : DO_NOT_GENERATE); - // optionsMap.put(OPTION_PreserveUnusedLocal, - // this.preserveAllLocalVariables ? PRESERVE : OPTIMIZE_OUT); - optionsMap.put(OPTION_DocCommentSupport, - this.docCommentSupport ? ENABLED : DISABLED); - optionsMap.put(OPTION_ReportMethodWithConstructorName, - getSeverityString(MethodWithConstructorName)); - optionsMap.put(OPTION_ReportOverridingPackageDefaultMethod, - getSeverityString(OverriddenPackageDefaultMethod)); - optionsMap.put(OPTION_ReportDeprecation, - getSeverityString(UsingDeprecatedAPI)); - optionsMap - .put(OPTION_ReportDeprecationInDeprecatedCode, - this.reportDeprecationInsideDeprecatedCode ? ENABLED - : DISABLED); - optionsMap.put(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, - this.reportDeprecationWhenOverridingDeprecatedMethod ? ENABLED - : DISABLED); - optionsMap.put(OPTION_ReportHiddenCatchBlock, - getSeverityString(MaskedCatchBlock)); - optionsMap.put(OPTION_ReportUnusedLocal, - getSeverityString(UnusedLocalVariable)); - optionsMap.put(OPTION_ReportUnusedParameter, - getSeverityString(UnusedArgument)); - optionsMap.put(OPTION_ReportUnusedImport, - getSeverityString(UnusedImport)); - optionsMap.put(OPTION_ReportSyntheticAccessEmulation, - getSeverityString(AccessEmulation)); - optionsMap.put(OPTION_ReportNoEffectAssignment, - getSeverityString(NoEffectAssignment)); - optionsMap.put(OPTION_ReportNonExternalizedStringLiteral, - getSeverityString(NonExternalizedString)); - optionsMap.put(OPTION_ReportNoImplicitStringConversion, - getSeverityString(NoImplicitStringConversion)); - optionsMap.put(OPTION_ReportNonStaticAccessToStatic, - getSeverityString(NonStaticAccessToStatic)); - optionsMap.put(OPTION_ReportIndirectStaticAccess, - getSeverityString(IndirectStaticAccess)); - optionsMap.put(OPTION_ReportIncompatibleNonInheritedInterfaceMethod, - getSeverityString(IncompatibleNonInheritedInterfaceMethod)); - optionsMap.put(OPTION_ReportUnusedPrivateMember, - getSeverityString(UnusedPrivateMember)); - optionsMap.put(OPTION_ReportLocalVariableHiding, - getSeverityString(LocalVariableHiding)); - optionsMap - .put(OPTION_ReportFieldHiding, getSeverityString(FieldHiding)); - optionsMap.put(OPTION_ReportPossibleAccidentalBooleanAssignment, - getSeverityString(AccidentalBooleanAssign)); - optionsMap.put(OPTION_ReportSuperfluousSemicolon, - getSeverityString(SuperfluousSemicolon)); - optionsMap.put(OPTION_ReportAssertIdentifier, - getSeverityString(AssertUsedAsAnIdentifier)); - optionsMap.put(OPTION_ReportUndocumentedEmptyBlock, - getSeverityString(UndocumentedEmptyBlock)); - optionsMap.put(OPTION_ReportUnnecessaryTypeCheck, - getSeverityString(UnnecessaryTypeCheck)); - optionsMap.put(OPTION_ReportInvalidJavadoc, - getSeverityString(InvalidJavadoc)); - optionsMap.put(OPTION_ReportInvalidJavadocTagsVisibility, - getVisibilityString(this.reportInvalidJavadocTagsVisibility)); - optionsMap.put(OPTION_ReportInvalidJavadocTags, - this.reportInvalidJavadocTags ? ENABLED : DISABLED); - optionsMap.put(OPTION_ReportMissingJavadocTags, - getSeverityString(MissingJavadocTags)); - optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility, - getVisibilityString(this.reportMissingJavadocTagsVisibility)); - optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding, - this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); - optionsMap.put(OPTION_ReportMissingJavadocComments, - getSeverityString(MissingJavadocComments)); - optionsMap - .put( - OPTION_ReportMissingJavadocCommentsVisibility, - getVisibilityString(this.reportMissingJavadocCommentsVisibility)); - optionsMap.put(OPTION_ReportMissingJavadocCommentsOverriding, - this.reportMissingJavadocCommentsOverriding ? ENABLED - : DISABLED); - optionsMap.put(OPTION_ReportFinallyBlockNotCompletingNormally, - getSeverityString(FinallyBlockNotCompleting)); - optionsMap.put(OPTION_ReportUnusedDeclaredThrownException, - getSeverityString(UnusedDeclaredThrownException)); - optionsMap - .put( - OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding, - this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED - : DISABLED); - optionsMap.put(OPTION_ReportUnqualifiedFieldAccess, - getSeverityString(UnqualifiedFieldAccess)); - // optionsMap.put(OPTION_Compliance, - // versionFromJdkLevel(this.complianceLevel)); - // optionsMap.put(OPTION_Source, versionFromJdkLevel(this.sourceLevel)); - // optionsMap.put(OPTION_TargetPlatform, - // versionFromJdkLevel(this.targetJDK)); - if (this.defaultEncoding != null) { - optionsMap.put(OPTION_Encoding, this.defaultEncoding); - } - optionsMap - .put( - OPTION_TaskTags, - this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags, ','))); //$NON-NLS-1$ - optionsMap - .put( - OPTION_TaskPriorities, - this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites, ','))); //$NON-NLS-1$ - optionsMap.put(OPTION_ReportUnusedParameterWhenImplementingAbstract, - this.reportUnusedParameterWhenImplementingAbstract ? ENABLED - : DISABLED); - optionsMap.put(OPTION_ReportUnusedParameterWhenOverridingConcrete, - this.reportUnusedParameterWhenOverridingConcrete ? ENABLED - : DISABLED); - optionsMap.put(OPTION_ReportSpecialParameterHidingField, - this.reportSpecialParameterHidingField ? ENABLED : DISABLED); - optionsMap.put(OPTION_MaxProblemPerUnit, String - .valueOf(this.maxProblemsPerUnit)); - - return optionsMap; - } +// public Map getMap() { +// Map optionsMap = new HashMap(30); +// optionsMap.put(OPTION_PHPIncludeNotExistWarning, +// getSeverityString(PHPIncludeNotExistWarning)); +// optionsMap.put(OPTION_PHPVarDeprecatedWarning, +// getSeverityString(PHPVarDeprecatedWarning)); +// optionsMap.put(OPTION_PHPBadStyleKeywordWarning, +// getSeverityString(PHPBadStyleKeywordWarning)); +// optionsMap.put(OPTION_PHPBadStyleUppercaseIdentifierWarning, +// getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); +// optionsMap.put(OPTION_UninitializedLocalVariableWarning, +// getSeverityString(UninitializedLocalVariableWarning)); +// optionsMap.put(OPTION_CodeCannotBeReachedWarning, +// getSeverityString(CodeCannotBeReachedWarning)); +// +// optionsMap.put(OPTION_LocalVariableAttribute, +// (this.produceDebugAttributes & Vars) != 0 ? GENERATE +// : DO_NOT_GENERATE); +// optionsMap.put(OPTION_LineNumberAttribute, +// (this.produceDebugAttributes & Lines) != 0 ? GENERATE +// : DO_NOT_GENERATE); +// optionsMap.put(OPTION_SourceFileAttribute, +// (this.produceDebugAttributes & Source) != 0 ? GENERATE +// : DO_NOT_GENERATE); +// // optionsMap.put(OPTION_PreserveUnusedLocal, +// // this.preserveAllLocalVariables ? PRESERVE : OPTIMIZE_OUT); +// optionsMap.put(OPTION_DocCommentSupport, +// this.docCommentSupport ? ENABLED : DISABLED); +// optionsMap.put(OPTION_ReportMethodWithConstructorName, +// getSeverityString(MethodWithConstructorName)); +// optionsMap.put(OPTION_ReportOverridingPackageDefaultMethod, +// getSeverityString(OverriddenPackageDefaultMethod)); +// optionsMap.put(OPTION_ReportDeprecation, +// getSeverityString(UsingDeprecatedAPI)); +// optionsMap +// .put(OPTION_ReportDeprecationInDeprecatedCode, +// this.reportDeprecationInsideDeprecatedCode ? ENABLED +// : DISABLED); +// optionsMap.put(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, +// this.reportDeprecationWhenOverridingDeprecatedMethod ? ENABLED +// : DISABLED); +// optionsMap.put(OPTION_ReportHiddenCatchBlock, +// getSeverityString(MaskedCatchBlock)); +// optionsMap.put(OPTION_ReportUnusedLocal, +// getSeverityString(UnusedLocalVariable)); +// optionsMap.put(OPTION_ReportUnusedParameter, +// getSeverityString(UnusedArgument)); +// optionsMap.put(OPTION_ReportUnusedImport, +// getSeverityString(UnusedImport)); +// optionsMap.put(OPTION_ReportSyntheticAccessEmulation, +// getSeverityString(AccessEmulation)); +// optionsMap.put(OPTION_ReportNoEffectAssignment, +// getSeverityString(NoEffectAssignment)); +// optionsMap.put(OPTION_ReportNonExternalizedStringLiteral, +// getSeverityString(NonExternalizedString)); +// optionsMap.put(OPTION_ReportNoImplicitStringConversion, +// getSeverityString(NoImplicitStringConversion)); +// optionsMap.put(OPTION_ReportNonStaticAccessToStatic, +// getSeverityString(NonStaticAccessToStatic)); +// optionsMap.put(OPTION_ReportIndirectStaticAccess, +// getSeverityString(IndirectStaticAccess)); +// optionsMap.put(OPTION_ReportIncompatibleNonInheritedInterfaceMethod, +// getSeverityString(IncompatibleNonInheritedInterfaceMethod)); +// optionsMap.put(OPTION_ReportUnusedPrivateMember, +// getSeverityString(UnusedPrivateMember)); +// optionsMap.put(OPTION_ReportLocalVariableHiding, +// getSeverityString(LocalVariableHiding)); +// optionsMap +// .put(OPTION_ReportFieldHiding, getSeverityString(FieldHiding)); +// optionsMap.put(OPTION_ReportPossibleAccidentalBooleanAssignment, +// getSeverityString(AccidentalBooleanAssign)); +// optionsMap.put(OPTION_ReportSuperfluousSemicolon, +// getSeverityString(SuperfluousSemicolon)); +// optionsMap.put(OPTION_ReportAssertIdentifier, +// getSeverityString(AssertUsedAsAnIdentifier)); +// optionsMap.put(OPTION_ReportUndocumentedEmptyBlock, +// getSeverityString(UndocumentedEmptyBlock)); +// optionsMap.put(OPTION_ReportUnnecessaryTypeCheck, +// getSeverityString(UnnecessaryTypeCheck)); +// optionsMap.put(OPTION_ReportInvalidJavadoc, +// getSeverityString(InvalidJavadoc)); +// optionsMap.put(OPTION_ReportInvalidJavadocTagsVisibility, +// getVisibilityString(this.reportInvalidJavadocTagsVisibility)); +// optionsMap.put(OPTION_ReportInvalidJavadocTags, +// this.reportInvalidJavadocTags ? ENABLED : DISABLED); +// optionsMap.put(OPTION_ReportMissingJavadocTags, +// getSeverityString(MissingJavadocTags)); +// optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility, +// getVisibilityString(this.reportMissingJavadocTagsVisibility)); +// optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding, +// this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); +// optionsMap.put(OPTION_ReportMissingJavadocComments, +// getSeverityString(MissingJavadocComments)); +// optionsMap +// .put( +// OPTION_ReportMissingJavadocCommentsVisibility, +// getVisibilityString(this.reportMissingJavadocCommentsVisibility)); +// optionsMap.put(OPTION_ReportMissingJavadocCommentsOverriding, +// this.reportMissingJavadocCommentsOverriding ? ENABLED +// : DISABLED); +// optionsMap.put(OPTION_ReportFinallyBlockNotCompletingNormally, +// getSeverityString(FinallyBlockNotCompleting)); +// optionsMap.put(OPTION_ReportUnusedDeclaredThrownException, +// getSeverityString(UnusedDeclaredThrownException)); +// optionsMap +// .put( +// OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding, +// this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED +// : DISABLED); +// optionsMap.put(OPTION_ReportUnqualifiedFieldAccess, +// getSeverityString(UnqualifiedFieldAccess)); +// // optionsMap.put(OPTION_Compliance, +// // versionFromJdkLevel(this.complianceLevel)); +// // optionsMap.put(OPTION_Source, versionFromJdkLevel(this.sourceLevel)); +// // optionsMap.put(OPTION_TargetPlatform, +// // versionFromJdkLevel(this.targetJDK)); +// if (this.defaultEncoding != null) { +// optionsMap.put(OPTION_Encoding, this.defaultEncoding); +// } +// optionsMap +// .put( +// OPTION_TaskTags, +// this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags, ','))); //$NON-NLS-1$ +// optionsMap +// .put( +// OPTION_TaskPriorities, +// this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites, ','))); //$NON-NLS-1$ +// optionsMap.put(OPTION_ReportUnusedParameterWhenImplementingAbstract, +// this.reportUnusedParameterWhenImplementingAbstract ? ENABLED +// : DISABLED); +// optionsMap.put(OPTION_ReportUnusedParameterWhenOverridingConcrete, +// this.reportUnusedParameterWhenOverridingConcrete ? ENABLED +// : DISABLED); +// optionsMap.put(OPTION_ReportSpecialParameterHidingField, +// this.reportSpecialParameterHidingField ? ENABLED : DISABLED); +// optionsMap.put(OPTION_MaxProblemPerUnit, String +// .valueOf(this.maxProblemsPerUnit)); +// +// return optionsMap; +// } public int getSeverity(long irritant) { if ((this.warningThreshold & irritant) != 0) @@ -853,9 +853,9 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, } } - public void setVerboseMode(boolean flag) { - this.verbose = flag; - } +// public void setVerboseMode(boolean flag) { +// this.verbose = flag; +// } public String toString() { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompilationUnitScope.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompilationUnitScope.java index b92b8f3..2682063 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompilationUnitScope.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompilationUnitScope.java @@ -17,7 +17,7 @@ import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration; import net.sourceforge.phpdt.internal.compiler.ast.ImportReference; import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration; import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter; -import net.sourceforge.phpdt.internal.compiler.util.CompoundNameVector; +//import net.sourceforge.phpdt.internal.compiler.util.CompoundNameVector; import net.sourceforge.phpdt.internal.compiler.util.HashtableOfObject; import net.sourceforge.phpdt.internal.compiler.util.HashtableOfType; import net.sourceforge.phpdt.internal.compiler.util.ObjectVector; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompoundNameVector.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompoundNameVector.java new file mode 100644 index 0000000..0342c5a --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompoundNameVector.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.compiler.lookup; + +import net.sourceforge.phpdt.core.compiler.CharOperation; + +public final class CompoundNameVector { + static int INITIAL_SIZE = 10; + + public int size; + + int maxSize; + + char[][][] elements; + +// public CompoundNameVector() { +// maxSize = INITIAL_SIZE; +// size = 0; +// elements = new char[maxSize][][]; +// } + + public void add(char[][] newElement) { + 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 + System.arraycopy(elements, 0, (elements = new char[maxSize][][]), + 0, size); + } + System.arraycopy(newElements, 0, elements, size, newElements.length); + size += newElements.length; + } + + public boolean contains(char[][] element) { + for (int i = size; --i >= 0;) + if (CharOperation.equals(element, elements[i])) + return true; + return false; + } + + public char[][] elementAt(int index) { + return elements[index]; + } + + public char[][] remove(char[][] element) { + // assumes only one occurrence of the element exists + for (int i = size; --i >= 0;) + if (element == elements[i]) { + // shift the remaining elements down one spot + System.arraycopy(elements, i + 1, elements, i, --size - i); + elements[size] = null; + return element; + } + return null; + } + + public void removeAll() { + for (int i = size; --i >= 0;) + elements[i] = null; + size = 0; + } + + public String toString() { + StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < size; i++) { + buffer.append(CharOperation.toString(elements[i])).append("\n"); //$NON-NLS-1$ + } + return buffer.toString(); + } +} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index 485d208..08ba9c4 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -93,10 +93,10 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, this.initializeScanner(); } - public void setFileToParse(IFile fileToParse) { - this.token = TokenNameEOF; - this.initializeScanner(); - } +// public void setFileToParse(IFile fileToParse) { +// this.token = TokenNameEOF; +// this.initializeScanner(); +// } /** * ClassDeclaration Constructor. @@ -106,26 +106,26 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, * Description of Parameter * @see */ - public Parser(IFile fileToParse) { - // if (keywordMap == null) { - // keywordMap = new HashMap(); - // for (int i = 0; i < PHP_KEYWORS.length; i++) { - // keywordMap.put(PHP_KEYWORS[i], new Integer(PHP_KEYWORD_TOKEN[i])); - // } - // } - // this.currentPHPString = 0; - // PHPParserSuperclass.fileToParse = fileToParse; - // this.phpList = null; - this.includesList = null; - // this.str = ""; - this.token = TokenNameEOF; - // this.chIndx = 0; - // this.rowCount = 1; - // this.columnCount = 0; - // this.phpEnd = false; - // getNextToken(); - this.initializeScanner(); - } +// public Parser(IFile fileToParse) { +// // if (keywordMap == null) { +// // keywordMap = new HashMap(); +// // for (int i = 0; i < PHP_KEYWORS.length; i++) { +// // keywordMap.put(PHP_KEYWORS[i], new Integer(PHP_KEYWORD_TOKEN[i])); +// // } +// // } +// // this.currentPHPString = 0; +// // PHPParserSuperclass.fileToParse = fileToParse; +// // this.phpList = null; +// this.includesList = null; +// // this.str = ""; +// this.token = TokenNameEOF; +// // this.chIndx = 0; +// // this.rowCount = 1; +// // this.columnCount = 0; +// // this.phpEnd = false; +// // getNextToken(); +// this.initializeScanner(); +// } public void initializeScanner() { this.scanner = new Scanner( @@ -4945,17 +4945,17 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, // return anomaliesDetected; // } // } - protected void pushOnAstLengthStack(int pos) { - try { - astLengthStack[++astLengthPtr] = pos; - } catch (IndexOutOfBoundsException e) { - int oldStackLength = astLengthStack.length; - int[] oldPos = astLengthStack; - astLengthStack = new int[oldStackLength + StackIncrement]; - System.arraycopy(oldPos, 0, astLengthStack, 0, oldStackLength); - astLengthStack[astLengthPtr] = pos; - } - } +// protected void pushOnAstLengthStack(int pos) { +// try { +// astLengthStack[++astLengthPtr] = pos; +// } catch (IndexOutOfBoundsException e) { +// int oldStackLength = astLengthStack.length; +// int[] oldPos = astLengthStack; +// astLengthStack = new int[oldStackLength + StackIncrement]; +// System.arraycopy(oldPos, 0, astLengthStack, 0, oldStackLength); +// astLengthStack[astLengthPtr] = pos; +// } +// } protected void pushOnAstStack(ASTNode node) { /* diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/ParserUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/ParserUtil.java deleted file mode 100644 index f81eb3c..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/ParserUtil.java +++ /dev/null @@ -1,53 +0,0 @@ -package net.sourceforge.phpdt.internal.compiler.parser; - -import java.util.List; - -import net.sourceforge.phpdt.core.ICompilationUnit; -import net.sourceforge.phpdt.core.IType; -import net.sourceforge.phpdt.core.JavaCore; -import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpdt.internal.compiler.ast.ImportReference; -import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference; - -import org.eclipse.core.resources.IFile; - -public class ParserUtil { - - public static SingleTypeReference getTypeReference(Scanner scanner, - List includesList, char[] ident) { - String identStr = new String(ident); - ImportReference ir; - IFile file = null; - for (int i = 0; i < includesList.size(); i++) { - ir = (ImportReference) includesList.get(i); - file = ir.getFile(); - if (file != null) { - ICompilationUnit unit = JavaCore - .createCompilationUnitFrom(file); - if (unit != null) { - try { - // TODO avoid recursion here. Sometimes we get a - // java.lang.StackOverflowError - IType[] types = unit.getAllTypes(); - if (types != null) { - for (int j = 0; j < types.length; j++) { - if (types[j].getElementName().equals(identStr)) { - return new SingleTypeReference( - file, - ident, - scanner - .getCurrentTokenStartPosition(), - scanner - .getCurrentTokenEndPosition()); - } - } - } - } catch (JavaModelException e) { - e.printStackTrace(); - } - } - } - } - return null; - } -} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/RecoveredElement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/RecoveredElement.java index 4cf3d75..6df1686 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/RecoveredElement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/RecoveredElement.java @@ -10,7 +10,7 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.compiler.parser; -import net.sourceforge.phpdt.internal.compiler.ast.ASTNode; +//import net.sourceforge.phpdt.internal.compiler.ast.ASTNode; import net.sourceforge.phpdt.internal.compiler.ast.Block; import net.sourceforge.phpdt.internal.compiler.ast.Statement; @@ -27,16 +27,16 @@ public class RecoveredElement { protected Parser recoveringParser; - public RecoveredElement(RecoveredElement parent, int bracketBalance) { - this(parent, bracketBalance, null); - } +// public RecoveredElement(RecoveredElement parent, int bracketBalance) { +// this(parent, bracketBalance, null); +// } - public RecoveredElement(RecoveredElement parent, int bracketBalance, - Parser parser) { - this.parent = parent; - this.bracketBalance = bracketBalance; - this.recoveringParser = parser; - } +// public RecoveredElement(RecoveredElement parent, int bracketBalance, +// Parser parser) { +// this.parent = parent; +// this.bracketBalance = bracketBalance; +// this.recoveringParser = parser; +// } /* * Record a method declaration @@ -147,13 +147,13 @@ public class RecoveredElement { /* * Answer the depth of this element, considering the parent link. */ - public int depth() { - int depth = 0; - RecoveredElement current = this; - while ((current = current.parent) != null) - depth++; - return depth; - } +// public int depth() { +// int depth = 0; +// RecoveredElement current = this; +// while ((current = current.parent) != null) +// depth++; +// return depth; +// } /* * Answer the enclosing method node, or null if none @@ -211,9 +211,9 @@ public class RecoveredElement { /* * Answer the associated parsed structure */ - public ASTNode parseTree() { - return null; - } +// public ASTNode parseTree() { +// return null; +// } /* * Iterate the enclosing blocks and tag them so as to preserve their content @@ -261,17 +261,17 @@ public class RecoveredElement { /* * Answer the very source end of the corresponding parse node */ - public int sourceEnd() { - return 0; - } - - protected String tabString(int tab) { - StringBuffer result = new StringBuffer(); - for (int i = tab; i > 0; i--) { - result.append(" "); //$NON-NLS-1$ - } - return result.toString(); - } +// public int sourceEnd() { +// return 0; +// } + +// protected String tabString(int tab) { +// StringBuffer result = new StringBuffer(); +// for (int i = tab; i > 0; i--) { +// result.append(" "); //$NON-NLS-1$ +// } +// return result.toString(); +// } /* * Answer the top node @@ -316,39 +316,39 @@ public class RecoveredElement { * Update the corresponding parse node from parser state which is about to * disappear because of restarting recovery */ - public void updateFromParserState() { - } +// public void updateFromParserState() { +// } /* * A closing brace got consumed, might have closed the current element, in * which case both the currentElement is exited */ - public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd) { - if ((--bracketBalance <= 0) && (parent != null)) { - this.updateSourceEndIfNecessary(braceEnd); - return parent; - } - return this; - } +// public RecoveredElement updateOnClosingBrace(int braceStart, int braceEnd) { +// if ((--bracketBalance <= 0) && (parent != null)) { +// this.updateSourceEndIfNecessary(braceEnd); +// return parent; +// } +// return this; +// } /* * An opening brace got consumed, might be the expected opening one of the * current element, in which case the bodyStart is updated. */ - public RecoveredElement updateOnOpeningBrace(int braceEnd) { - - if (bracketBalance++ == 0) { - this.updateBodyStart(braceEnd + 1); - return this; - } - return null; // no update is necessary - } +// public RecoveredElement updateOnOpeningBrace(int braceEnd) { +// +// if (bracketBalance++ == 0) { +// this.updateBodyStart(braceEnd + 1); +// return this; +// } +// return null; // no update is necessary +// } /* * Final update the corresponding parse node */ - public void updateParseTree() { - } +// public void updateParseTree() { +// } /* * Update the declarationSourceEnd of the corresponding parse node diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index eeff2c1..4e52fb8 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -349,13 +349,13 @@ public class Scanner implements IScanner, ITerminalSymbols { // <= 0xFF); } - public static boolean isSQLIdentifierPart(char ch) { - if (ch < MAX_OBVIOUS) { - return ObviousIdentCharNatures[ch] == C_LETTER - || ObviousIdentCharNatures[ch] == C_DIGIT; - } - return false; - } +// public static boolean isSQLIdentifierPart(char ch) { +// if (ch < MAX_OBVIOUS) { +// return ObviousIdentCharNatures[ch] == C_LETTER +// || ObviousIdentCharNatures[ch] == C_DIGIT; +// } +// return false; +// } public final boolean atEnd() { // This code is not relevant if source is @@ -476,22 +476,22 @@ public class Scanner implements IScanner, ITerminalSymbols { return true; } - public final char[] getRawTokenSourceEnd() { - int length = this.eofPosition - this.currentPosition - 1; - char[] sourceEnd = new char[length]; - System.arraycopy(this.source, this.currentPosition, sourceEnd, 0, - length); - return sourceEnd; - } +// public final char[] getRawTokenSourceEnd() { +// int length = this.eofPosition - this.currentPosition - 1; +// char[] sourceEnd = new char[length]; +// System.arraycopy(this.source, this.currentPosition, sourceEnd, 0, +// length); +// return sourceEnd; +// } public int getCurrentTokenStartPosition() { return this.startPosition; } - public final String getCurrentStringLiteral() { - char[] result = getCurrentStringLiteralSource(); - return new String(result); - } +// public final String getCurrentStringLiteral() { +// char[] result = getCurrentStringLiteralSource(); +// return new String(result); +// } public final char[] getCurrentStringLiteralSource() { // Return the token REAL source (aka unicodes are precomputed) @@ -508,16 +508,16 @@ public class Scanner implements IScanner, ITerminalSymbols { return result; } - public final char[] getCurrentStringLiteralSource(int startPos) { - // Return the token REAL source (aka unicodes are precomputed) - char[] result; - int length; - System.arraycopy(source, startPos + 1, - result = new char[length = currentPosition - startPos - 2], 0, - length); - // } - return result; - } +// public final char[] getCurrentStringLiteralSource(int startPos) { +// // Return the token REAL source (aka unicodes are precomputed) +// char[] result; +// int length; +// System.arraycopy(source, startPos + 1, +// result = new char[length = currentPosition - startPos - 2], 0, +// length); +// // } +// return result; +// } /* * Search the source position corresponding to the end of a given line diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/SyntaxError.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/SyntaxError.java index be39dd6..71384cc 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/SyntaxError.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/SyntaxError.java @@ -5,6 +5,11 @@ package net.sourceforge.phpdt.internal.compiler.parser; */ public class SyntaxError extends Error { + /** + * + */ + private static final long serialVersionUID = -8723926000065578914L; + /** The line where the error start */ int lineNumber; @@ -65,7 +70,7 @@ public class SyntaxError extends Error { * * @return the line number */ - public int getLine() { - return lineNumber; - } +// public int getLine() { +// return lineNumber; +// } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java index 2cb8d91..a22b3c4 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java @@ -1,9 +1,9 @@ package net.sourceforge.phpdt.internal.compiler.parser; -import net.sourceforge.phpdt.core.IJavaModelMarker; -import net.sourceforge.phpdt.core.compiler.IProblem; +//import net.sourceforge.phpdt.core.IJavaModelMarker; +//import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.internal.compiler.CompilationResult; -import net.sourceforge.phpdt.internal.compiler.ast.ASTNode; +//import net.sourceforge.phpdt.internal.compiler.ast.ASTNode; import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration; import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration; import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration; @@ -14,9 +14,9 @@ import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit; import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation; import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; +//import org.eclipse.core.resources.IMarker; +//import org.eclipse.core.resources.IResource; +//import org.eclipse.core.runtime.CoreException; /** * @@ -188,41 +188,41 @@ public class UnitParser extends Parser { * problem's range - it has an extra attribute "ID" which holds the * problem's id */ - protected void storeProblemsFor(IResource resource, IProblem[] problems) - throws CoreException { - if (resource == null || problems == null || problems.length == 0) - return; - - for (int i = 0, l = problems.length; i < l; i++) { - IProblem problem = problems[i]; - int id = problem.getID(); - if (id != IProblem.Task) { - IMarker marker = resource - .createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); - marker - .setAttributes( - new String[] { IMarker.MESSAGE, - IMarker.SEVERITY, IJavaModelMarker.ID, - IMarker.CHAR_START, IMarker.CHAR_END, - IMarker.LINE_NUMBER, - IJavaModelMarker.ARGUMENTS }, - new Object[] { - problem.getMessage(), - new Integer( - problem.isError() ? IMarker.SEVERITY_ERROR - : IMarker.SEVERITY_WARNING), - new Integer(id), - new Integer(problem.getSourceStart()), - new Integer(problem.getSourceEnd() + 1), - new Integer(problem - .getSourceLineNumber()), - net.sourceforge.phpdt.internal.core.util.Util - .getProblemArgumentsForMarker(problem - .getArguments()) }); - } - - } - } +// protected void storeProblemsFor(IResource resource, IProblem[] problems) +// throws CoreException { +// if (resource == null || problems == null || problems.length == 0) +// return; +// +// for (int i = 0, l = problems.length; i < l; i++) { +// IProblem problem = problems[i]; +// int id = problem.getID(); +// if (id != IProblem.Task) { +// IMarker marker = resource +// .createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); +// marker +// .setAttributes( +// new String[] { IMarker.MESSAGE, +// IMarker.SEVERITY, IJavaModelMarker.ID, +// IMarker.CHAR_START, IMarker.CHAR_END, +// IMarker.LINE_NUMBER, +// IJavaModelMarker.ARGUMENTS }, +// new Object[] { +// problem.getMessage(), +// new Integer( +// problem.isError() ? IMarker.SEVERITY_ERROR +// : IMarker.SEVERITY_WARNING), +// new Integer(id), +// new Integer(problem.getSourceStart()), +// new Integer(problem.getSourceEnd() + 1), +// new Integer(problem +// .getSourceLineNumber()), +// net.sourceforge.phpdt.internal.core.util.Util +// .getProblemArgumentsForMarker(problem +// .getArguments()) }); +// } +// +// } +// } // A P I @@ -418,33 +418,33 @@ public class UnitParser extends Parser { // A P I - public CompilationUnitDeclaration parse(ICompilationUnit sourceUnit, - CompilationResult compilationResult, int start, int end) { - // parses a compilation unit and manages error handling (even bugs....) - - CompilationUnitDeclaration unit; - try { - /* automaton initialization */ - initialize(false); - goForCompilationUnit(); - - /* scanner initialization */ - scanner.setSource(sourceUnit, sourceUnit.getContents()); - scanner.resetTo(start, end); - /* unit creation */ - referenceContext = compilationUnit = new CompilationUnitDeclaration( - problemReporter, compilationResult, scanner.source.length); - - /* run automaton */ - parse(); - } catch (SyntaxError syntaxError) { - // - } finally { - unit = compilationUnit; - compilationUnit = null; // reset parser - } - return unit; - } +// public CompilationUnitDeclaration parse(ICompilationUnit sourceUnit, +// CompilationResult compilationResult, int start, int end) { +// // parses a compilation unit and manages error handling (even bugs....) +// +// CompilationUnitDeclaration unit; +// try { +// /* automaton initialization */ +// initialize(false); +// goForCompilationUnit(); +// +// /* scanner initialization */ +// scanner.setSource(sourceUnit, sourceUnit.getContents()); +// scanner.resetTo(start, end); +// /* unit creation */ +// referenceContext = compilationUnit = new CompilationUnitDeclaration( +// problemReporter, compilationResult, scanner.source.length); +// +// /* run automaton */ +// parse(); +// } catch (SyntaxError syntaxError) { +// // +// } finally { +// unit = compilationUnit; +// compilationUnit = null; // reset parser +// } +// return unit; +// } public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult) { @@ -465,52 +465,52 @@ public class UnitParser extends Parser { return parsedUnit; } - public void getMethodBodies(CompilationUnitDeclaration unit) { - // fill the methods bodies in order for the code to be generated - - if (unit == null) - return; - - if (unit.ignoreMethodBodies) { - unit.ignoreFurtherInvestigation = true; - return; - // if initial diet parse did not work, no need to dig into method - // bodies. - } - - if ((unit.bits & ASTNode.HasAllMethodBodies) != 0) - return; // work already done ... - - // real parse of the method.... - char[] contents = unit.compilationResult.compilationUnit.getContents(); - this.scanner.setSource(contents); - - // save existing values to restore them at the end of the parsing - // process - // see bug 47079 for more details - int[] oldLineEnds = this.scanner.lineEnds; - int oldLinePtr = this.scanner.linePtr; - - final int[] lineSeparatorPositions = unit.compilationResult.lineSeparatorPositions; - this.scanner.lineEnds = lineSeparatorPositions; - this.scanner.linePtr = lineSeparatorPositions.length - 1; - - // if (this.javadocParser != null && this.javadocParser.checkDocComment) - // { - // this.javadocParser.scanner.setSource(contents); - // } - if (unit.types != null) { - for (int i = unit.types.size(); --i >= 0;) - ((TypeDeclaration) unit.types.get(i)).parseMethod(this, unit); - } - - // tag unit has having read bodies - unit.bits |= ASTNode.HasAllMethodBodies; - - // this is done to prevent any side effects on the compilation unit - // result - // line separator positions array. - this.scanner.lineEnds = oldLineEnds; - this.scanner.linePtr = oldLinePtr; - } +// public void getMethodBodies(CompilationUnitDeclaration unit) { +// // fill the methods bodies in order for the code to be generated +// +// if (unit == null) +// return; +// +// if (unit.ignoreMethodBodies) { +// unit.ignoreFurtherInvestigation = true; +// return; +// // if initial diet parse did not work, no need to dig into method +// // bodies. +// } +// +// if ((unit.bits & ASTNode.HasAllMethodBodies) != 0) +// return; // work already done ... +// +// // real parse of the method.... +// char[] contents = unit.compilationResult.compilationUnit.getContents(); +// this.scanner.setSource(contents); +// +// // save existing values to restore them at the end of the parsing +// // process +// // see bug 47079 for more details +// int[] oldLineEnds = this.scanner.lineEnds; +// int oldLinePtr = this.scanner.linePtr; +// +// final int[] lineSeparatorPositions = unit.compilationResult.lineSeparatorPositions; +// this.scanner.lineEnds = lineSeparatorPositions; +// this.scanner.linePtr = lineSeparatorPositions.length - 1; +// +// // if (this.javadocParser != null && this.javadocParser.checkDocComment) +// // { +// // this.javadocParser.scanner.setSource(contents); +// // } +// if (unit.types != null) { +// for (int i = unit.types.size(); --i >= 0;) +// ((TypeDeclaration) unit.types.get(i)).parseMethod(this, unit); +// } +// +// // tag unit has having read bodies +// unit.bits |= ASTNode.HasAllMethodBodies; +// +// // this is done to prevent any side effects on the compilation unit +// // result +// // line separator positions array. +// this.scanner.lineEnds = oldLineEnds; +// this.scanner.linePtr = oldLinePtr; +// } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortCompilation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortCompilation.java index 6d4c650..21f3757 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortCompilation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortCompilation.java @@ -19,6 +19,11 @@ import net.sourceforge.phpdt.internal.compiler.CompilationResult; */ public class AbortCompilation extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = -3674083924553307963L; + public CompilationResult compilationResult; public Throwable exception; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortCompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortCompilationUnit.java index 8e4407b..92ddb4c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortCompilationUnit.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortCompilationUnit.java @@ -18,6 +18,11 @@ import net.sourceforge.phpdt.internal.compiler.CompilationResult; * should only be thrown from within problem handlers. */ public class AbortCompilationUnit extends AbortCompilation { + /** + * + */ + private static final long serialVersionUID = -3222208987438059121L; + public AbortCompilationUnit(CompilationResult compilationResult) { super(compilationResult); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortMethod.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortMethod.java index 8ac6b34..60ce6c1 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortMethod.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortMethod.java @@ -18,6 +18,11 @@ import net.sourceforge.phpdt.internal.compiler.CompilationResult; * should only be thrown from within problem handlers. */ public class AbortMethod extends AbortType { + /** + * + */ + private static final long serialVersionUID = 4628813219671313506L; + public AbortMethod(CompilationResult compilationResult) { super(compilationResult); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortType.java index 8f370d6..0d759a8 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortType.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/AbortType.java @@ -18,6 +18,11 @@ import net.sourceforge.phpdt.internal.compiler.CompilationResult; * should only be thrown from within problem handlers. */ public class AbortType extends AbortCompilationUnit { + /** + * + */ + private static final long serialVersionUID = -874610762828349876L; + public AbortType(CompilationResult compilationResult) { super(compilationResult); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/DefaultProblem.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/DefaultProblem.java index be82160..fe14b8c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/DefaultProblem.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/DefaultProblem.java @@ -11,7 +11,7 @@ package net.sourceforge.phpdt.internal.compiler.problem; import net.sourceforge.phpdt.core.compiler.IProblem; -import net.sourceforge.phpdt.internal.compiler.util.Util; +//import net.sourceforge.phpdt.internal.compiler.util.Util; public class DefaultProblem implements ProblemSeverities, IProblem { private char[] fileName; @@ -39,54 +39,54 @@ public class DefaultProblem implements ProblemSeverities, IProblem { this.line = line; } - public String errorReportSource(char[] unitSource) { - // 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 Util.bind("problem.noSourceInformation"); //$NON-NLS-1$ - StringBuffer errorBuffer = new StringBuffer(" "); //$NON-NLS-1$ - errorBuffer.append(Util.bind("problem.atLine", String.valueOf(line))); //$NON-NLS-1$ - errorBuffer.append("\n\t"); //$NON-NLS-1$ - char c; - final char SPACE = '\u0020'; - final char MARK = '^'; - final char TAB = '\t'; - // 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 !) - // expand to line limits - int length = unitSource.length, begin, end; - for (begin = startPosition >= length ? length - 1 : startPosition; begin > 0; begin--) { - if ((c = unitSource[begin - 1]) == '\n' || c == '\r') - break; - } - for (end = endPosition >= length ? length - 1 : endPosition; end + 1 < length; end++) { - if ((c = unitSource[end + 1]) == '\r' || c == '\n') - break; - } - // trim left and right spaces/tabs - while ((c = unitSource[begin]) == ' ' || c == '\t') - begin++; - // while ((c = unitSource[end]) == ' ' || c == '\t') end--; TODO - // (philippe) should also trim right, but all tests are to be updated - // copy source - errorBuffer.append(unitSource, begin, end - begin + 1); - errorBuffer.append("\n\t"); //$NON-NLS-1$ - // compute underline - for (int i = begin; i < startPosition; i++) { - errorBuffer.append((unitSource[i] == TAB) ? TAB : SPACE); - } - for (int i = startPosition; i <= (endPosition >= length ? length - 1 - : endPosition); i++) { - errorBuffer.append(MARK); - } - return errorBuffer.toString(); - } +// public String errorReportSource(char[] unitSource) { +// // 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 Util.bind("problem.noSourceInformation"); //$NON-NLS-1$ +// StringBuffer errorBuffer = new StringBuffer(" "); //$NON-NLS-1$ +// errorBuffer.append(Util.bind("problem.atLine", String.valueOf(line))); //$NON-NLS-1$ +// errorBuffer.append("\n\t"); //$NON-NLS-1$ +// char c; +// final char SPACE = '\u0020'; +// final char MARK = '^'; +// final char TAB = '\t'; +// // 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 !) +// // expand to line limits +// int length = unitSource.length, begin, end; +// for (begin = startPosition >= length ? length - 1 : startPosition; begin > 0; begin--) { +// if ((c = unitSource[begin - 1]) == '\n' || c == '\r') +// break; +// } +// for (end = endPosition >= length ? length - 1 : endPosition; end + 1 < length; end++) { +// if ((c = unitSource[end + 1]) == '\r' || c == '\n') +// break; +// } +// // trim left and right spaces/tabs +// while ((c = unitSource[begin]) == ' ' || c == '\t') +// begin++; +// // while ((c = unitSource[end]) == ' ' || c == '\t') end--; TODO +// // (philippe) should also trim right, but all tests are to be updated +// // copy source +// errorBuffer.append(unitSource, begin, end - begin + 1); +// errorBuffer.append("\n\t"); //$NON-NLS-1$ +// // compute underline +// for (int i = begin; i < startPosition; i++) { +// errorBuffer.append((unitSource[i] == TAB) ? TAB : SPACE); +// } +// for (int i = startPosition; i <= (endPosition >= length ? length - 1 +// : endPosition); i++) { +// errorBuffer.append(MARK); +// } +// return errorBuffer.toString(); +// } // public String errorReportSource(ITextEditor textEditor){ // //ICompilationUnit compilationUnit) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/DefaultProblemFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/DefaultProblemFactory.java index a9bcabc..37aa878 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/DefaultProblemFactory.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/DefaultProblemFactory.java @@ -145,9 +145,9 @@ public class DefaultProblemFactory implements IProblemFactory { * net.sourceforge.phpdt.internal.compiler.IProblem * @return String */ - public final String localizedMessage(IProblem problem) { - return getLocalizedMessage(problem.getID(), problem.getArguments()); - } +// public final String localizedMessage(IProblem problem) { +// return getLocalizedMessage(problem.getID(), problem.getArguments()); +// } /** * This method initializes the MessageTemplates class variable according to diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java index 2c92e38..9758077 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java @@ -3591,13 +3591,13 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { compilationResult); } - public void phpParsingWarning(String[] messageArguments, - int problemStartPosition, int problemEndPosition, - ReferenceContext context, CompilationResult compilationResult) { - this.handle(IProblem.PHPParsingWarning, NoArgument, messageArguments, - problemStartPosition, problemEndPosition, context, - compilationResult); - } +// public void phpParsingWarning(String[] messageArguments, +// int problemStartPosition, int problemEndPosition, +// ReferenceContext context, CompilationResult compilationResult) { +// this.handle(IProblem.PHPParsingWarning, NoArgument, messageArguments, +// problemStartPosition, problemEndPosition, context, +// compilationResult); +// } public void phpVarDeprecatedWarning(int problemStartPosition, int problemEndPosition, ReferenceContext context, diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ShouldNotImplement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ShouldNotImplement.java index d0834bc..68f9a23 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ShouldNotImplement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ShouldNotImplement.java @@ -17,8 +17,13 @@ package net.sourceforge.phpdt.internal.compiler.problem; * (internal only) */ public class ShouldNotImplement extends RuntimeException { - public ShouldNotImplement() { - } + /** + * + */ + private static final long serialVersionUID = 599981042161407964L; + +// public ShouldNotImplement() { +// } public ShouldNotImplement(String message) { super(message); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/CompoundNameVector.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/CompoundNameVector.java deleted file mode 100644 index bb12be0..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/CompoundNameVector.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.compiler.util; - -import net.sourceforge.phpdt.core.compiler.CharOperation; - -public final class CompoundNameVector { - static int INITIAL_SIZE = 10; - - public int size; - - int maxSize; - - char[][][] elements; - - public CompoundNameVector() { - maxSize = INITIAL_SIZE; - size = 0; - elements = new char[maxSize][][]; - } - - public void add(char[][] newElement) { - 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 - System.arraycopy(elements, 0, (elements = new char[maxSize][][]), - 0, size); - } - System.arraycopy(newElements, 0, elements, size, newElements.length); - size += newElements.length; - } - - public boolean contains(char[][] element) { - for (int i = size; --i >= 0;) - if (CharOperation.equals(element, elements[i])) - return true; - return false; - } - - public char[][] elementAt(int index) { - return elements[index]; - } - - public char[][] remove(char[][] element) { - // assumes only one occurrence of the element exists - for (int i = size; --i >= 0;) - if (element == elements[i]) { - // shift the remaining elements down one spot - System.arraycopy(elements, i + 1, elements, i, --size - i); - elements[size] = null; - return element; - } - return null; - } - - public void removeAll() { - for (int i = size; --i >= 0;) - elements[i] = null; - size = 0; - } - - public String toString() { - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < size; i++) { - buffer.append(CharOperation.toString(elements[i])).append("\n"); //$NON-NLS-1$ - } - return buffer.toString(); - } -} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfInt.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfInt.java deleted file mode 100644 index 751806c..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfInt.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.compiler.util; - -/** - * Hashtable for non-zero int keys. - */ - -public final class HashtableOfInt { - // to avoid using Enumerations, walk the individual tables skipping nulls - public int[] keyTable; - - public Object[] valueTable; - - int elementSize; // number of elements in the table - - int threshold; - - public HashtableOfInt() { - this(13); - } - - public HashtableOfInt(int size) { - this.elementSize = 0; - this.threshold = size; // size represents the expected number of - // elements - int extraRoom = (int) (size * 1.75f); - if (this.threshold == extraRoom) - extraRoom++; - this.keyTable = new int[extraRoom]; - this.valueTable = new Object[extraRoom]; - } - - public boolean containsKey(int key) { - int index = key % valueTable.length; - int currentKey; - while ((currentKey = keyTable[index]) != 0) { - if (currentKey == key) - return true; - index = (index + 1) % keyTable.length; - } - return false; - } - - public Object get(int key) { - int index = key % valueTable.length; - int currentKey; - while ((currentKey = keyTable[index]) != 0) { - if (currentKey == key) - return valueTable[index]; - index = (index + 1) % keyTable.length; - } - return null; - } - - public Object put(int key, Object value) { - int index = key % valueTable.length; - int currentKey; - while ((currentKey = keyTable[index]) != 0) { - if (currentKey == key) - return valueTable[index] = value; - index = (index + 1) % keyTable.length; - } - keyTable[index] = key; - valueTable[index] = value; - - // assumes the threshold is never equal to the size of the table - if (++elementSize > threshold) - rehash(); - return value; - } - - private void rehash() { - HashtableOfInt newHashtable = new HashtableOfInt(elementSize * 2); // double - // the - // number - // of - // expected - // elements - int currentKey; - for (int i = keyTable.length; --i >= 0;) - if ((currentKey = keyTable[i]) != 0) - newHashtable.put(currentKey, valueTable[i]); - - this.keyTable = newHashtable.keyTable; - this.valueTable = newHashtable.valueTable; - this.threshold = newHashtable.threshold; - } - - public int size() { - return elementSize; - } - - public String toString() { - String s = ""; //$NON-NLS-1$ - Object object; - for (int i = 0, length = valueTable.length; i < length; i++) - if ((object = valueTable[i]) != null) - s += keyTable[i] + " -> " + object.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$ - return s; - } -} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfIntValues.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfIntValues.java deleted file mode 100644 index 1423f9e..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfIntValues.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.compiler.util; - -import net.sourceforge.phpdt.core.compiler.CharOperation; - -/** - * Hashtable of {char[] --> int} - */ -public final class HashtableOfIntValues implements Cloneable { - - public static final int NO_VALUE = Integer.MIN_VALUE; - - // to avoid using Enumerations, walk the individual tables skipping nulls - public char[] keyTable[]; - - public int valueTable[]; - - public int elementSize; // number of elements in the table - - int threshold; - - public HashtableOfIntValues() { - this(13); - } - - public HashtableOfIntValues(int size) { - - this.elementSize = 0; - this.threshold = size; // size represents the expected number of - // elements - int extraRoom = (int) (size * 1.75f); - if (this.threshold == extraRoom) - extraRoom++; - this.keyTable = new char[extraRoom][]; - this.valueTable = new int[extraRoom]; - } - - public Object clone() throws CloneNotSupportedException { - HashtableOfIntValues result = (HashtableOfIntValues) super.clone(); - result.elementSize = this.elementSize; - result.threshold = this.threshold; - - int length = this.keyTable.length; - result.keyTable = new char[length][]; - System.arraycopy(this.keyTable, 0, result.keyTable, 0, length); - - length = this.valueTable.length; - result.valueTable = new int[length]; - System.arraycopy(this.valueTable, 0, result.valueTable, 0, length); - return result; - } - - public boolean containsKey(char[] key) { - - int index = CharOperation.hashCode(key) % valueTable.length; - int keyLength = key.length; - char[] currentKey; - while ((currentKey = keyTable[index]) != null) { - if (currentKey.length == keyLength - && CharOperation.equals(currentKey, key)) - return true; - index = (index + 1) % keyTable.length; - } - return false; - } - - public int get(char[] key) { - - int index = CharOperation.hashCode(key) % valueTable.length; - int keyLength = key.length; - char[] currentKey; - while ((currentKey = keyTable[index]) != null) { - if (currentKey.length == keyLength - && CharOperation.equals(currentKey, key)) - return valueTable[index]; - index = (index + 1) % keyTable.length; - } - return NO_VALUE; - } - - public int put(char[] key, int value) { - - int index = CharOperation.hashCode(key) % valueTable.length; - int keyLength = key.length; - char[] currentKey; - while ((currentKey = keyTable[index]) != null) { - if (currentKey.length == keyLength - && CharOperation.equals(currentKey, key)) - return valueTable[index] = value; - index = (index + 1) % keyTable.length; - } - keyTable[index] = key; - valueTable[index] = value; - - // assumes the threshold is never equal to the size of the table - if (++elementSize > threshold) - rehash(); - return value; - } - - public int removeKey(char[] key) { - - int index = CharOperation.hashCode(key) % valueTable.length; - int keyLength = key.length; - char[] currentKey; - while ((currentKey = keyTable[index]) != null) { - if (currentKey.length == keyLength - && CharOperation.equals(currentKey, key)) { - int value = valueTable[index]; - elementSize--; - keyTable[index] = null; - valueTable[index] = NO_VALUE; - rehash(); - return value; - } - index = (index + 1) % keyTable.length; - } - return NO_VALUE; - } - - private void rehash() { - - HashtableOfIntValues newHashtable = new HashtableOfIntValues( - elementSize * 2); // double the number of expected elements - char[] currentKey; - for (int i = keyTable.length; --i >= 0;) - if ((currentKey = keyTable[i]) != null) - newHashtable.put(currentKey, valueTable[i]); - - this.keyTable = newHashtable.keyTable; - this.valueTable = newHashtable.valueTable; - this.threshold = newHashtable.threshold; - } - - public int size() { - return elementSize; - } - - public String toString() { - String s = ""; //$NON-NLS-1$ - char[] key; - for (int i = 0, length = valueTable.length; i < length; i++) - if ((key = keyTable[i]) != null) - s += new String(key) + " -> " + valueTable[i] + "\n"; //$NON-NLS-2$ //$NON-NLS-1$ - return s; - } -} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfLong.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfLong.java deleted file mode 100644 index 4b80c87..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfLong.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.compiler.util; - -/** - * Hashtable for non-zero long keys. - */ - -public final class HashtableOfLong { - // to avoid using Enumerations, walk the individual tables skipping nulls - public long[] keyTable; - - public Object[] valueTable; - - int elementSize; // number of elements in the table - - int threshold; - - public HashtableOfLong() { - this(13); - } - - public HashtableOfLong(int size) { - this.elementSize = 0; - this.threshold = size; // size represents the expected number of - // elements - int extraRoom = (int) (size * 1.75f); - if (this.threshold == extraRoom) - extraRoom++; - this.keyTable = new long[extraRoom]; - this.valueTable = new Object[extraRoom]; - } - - public boolean containsKey(long key) { - int index = ((int) (key >>> 32)) % valueTable.length; - long currentKey; - while ((currentKey = keyTable[index]) != 0) { - if (currentKey == key) - return true; - index = (index + 1) % keyTable.length; - } - return false; - } - - public Object get(long key) { - int index = ((int) (key >>> 32)) % valueTable.length; - long currentKey; - while ((currentKey = keyTable[index]) != 0) { - if (currentKey == key) - return valueTable[index]; - index = (index + 1) % keyTable.length; - } - return null; - } - - public Object put(long key, Object value) { - int index = ((int) (key >>> 32)) % valueTable.length; - long currentKey; - while ((currentKey = keyTable[index]) != 0) { - if (currentKey == key) - return valueTable[index] = value; - index = (index + 1) % keyTable.length; - } - keyTable[index] = key; - valueTable[index] = value; - - // assumes the threshold is never equal to the size of the table - if (++elementSize > threshold) - rehash(); - return value; - } - - private void rehash() { - HashtableOfLong newHashtable = new HashtableOfLong(elementSize * 2); // double - // the - // number - // of - // expected - // elements - long currentKey; - for (int i = keyTable.length; --i >= 0;) - if ((currentKey = keyTable[i]) != 0) - newHashtable.put(currentKey, valueTable[i]); - - this.keyTable = newHashtable.keyTable; - this.valueTable = newHashtable.valueTable; - this.threshold = newHashtable.threshold; - } - - public int size() { - return elementSize; - } - - public String toString() { - String s = ""; //$NON-NLS-1$ - Object object; - for (int i = 0, length = valueTable.length; i < length; i++) - if ((object = valueTable[i]) != null) - s += keyTable[i] + " -> " + object.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$ - return s; - } -} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/SuffixConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/SuffixConstants.java deleted file mode 100644 index 8dd10d9..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/SuffixConstants.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package net.sourceforge.phpdt.internal.compiler.util; - -public interface SuffixConstants { - // public final static String EXTENSION_class = "class"; //$NON-NLS-1$ - // public final static String EXTENSION_CLASS = "CLASS"; //$NON-NLS-1$ - public final static String EXTENSION_php = "php"; //$NON-NLS-1$ - - public final static String EXTENSION_PHP = "PHP"; //$NON-NLS-1$ - - // public final static String SUFFIX_STRING_class = "." + EXTENSION_class; - // //$NON-NLS-1$ - // public final static String SUFFIX_STRING_CLASS = "." + EXTENSION_CLASS; - // //$NON-NLS-1$ - public final static String SUFFIX_STRING_php = "." + EXTENSION_php; //$NON-NLS-1$ - - public final static String SUFFIX_STRING_PHP = "." + EXTENSION_PHP; //$NON-NLS-1$ - - // public final static char[] SUFFIX_class = - // SUFFIX_STRING_class.toCharArray(); - // public final static char[] SUFFIX_CLASS = - // SUFFIX_STRING_CLASS.toCharArray(); - public final static char[] SUFFIX_php = SUFFIX_STRING_php.toCharArray(); - - public final static char[] SUFFIX_PHP = SUFFIX_STRING_PHP.toCharArray(); - - // public final static String EXTENSION_jar = "jar"; //$NON-NLS-1$ - // public final static String EXTENSION_JAR = "JAR"; //$NON-NLS-1$ - // public final static String EXTENSION_zip = "zip"; //$NON-NLS-1$ - // public final static String EXTENSION_ZIP = "ZIP"; //$NON-NLS-1$ - - // public final static String SUFFIX_STRING_jar = "." + EXTENSION_jar; - // //$NON-NLS-1$ - // public final static String SUFFIX_STRING_JAR = "." + EXTENSION_JAR; - // //$NON-NLS-1$ - // public final static String SUFFIX_STRING_zip = "." + EXTENSION_zip; - // //$NON-NLS-1$ - // public final static String SUFFIX_STRING_ZIP = "." + EXTENSION_ZIP; - // //$NON-NLS-1$ - - // public final static char[] SUFFIX_jar = SUFFIX_STRING_jar.toCharArray(); - // public final static char[] SUFFIX_JAR = SUFFIX_STRING_JAR.toCharArray(); - // public final static char[] SUFFIX_zip = SUFFIX_STRING_zip.toCharArray(); - // public final static char[] SUFFIX_ZIP = SUFFIX_STRING_ZIP.toCharArray(); -} \ No newline at end of file -- 1.7.1