X-Git-Url: http://git.phpeclipse.com 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 23f61e3..78baf7d 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 @@ -24,7 +24,6 @@ import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding; import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding; import net.sourceforge.phpdt.internal.compiler.lookup.ProblemMethodBinding; import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReasons; -import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReferenceBinding; import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding; import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding; import net.sourceforge.phpdt.internal.compiler.lookup.SyntheticArgumentBinding; @@ -54,7 +53,6 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall; import net.sourceforge.phpeclipse.internal.compiler.ast.Expression; import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration; import net.sourceforge.phpeclipse.internal.compiler.ast.FieldReference; -import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference; import net.sourceforge.phpeclipse.internal.compiler.ast.InstanceOfExpression; import net.sourceforge.phpeclipse.internal.compiler.ast.IntLiteral; import net.sourceforge.phpeclipse.internal.compiler.ast.Literal; @@ -295,11 +293,11 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { new String(method.selector), parametersAsShortString(method)}, messageSend.sourceStart, messageSend.sourceEnd); } - public void cannotImportPackage(ImportReference importRef) { - String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; - this.handle(IProblem.CannotImportPackage, arguments, arguments, - importRef.sourceStart, importRef.sourceEnd); - } +// public void cannotImportPackage(ImportReference importRef) { +// String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; +// this.handle(IProblem.CannotImportPackage, arguments, arguments, +// importRef.sourceStart, importRef.sourceEnd); +// } public void cannotInstantiate(TypeReference typeRef, TypeBinding type) { this.handle(IProblem.InvalidClassInstantiation, new String[]{new String( type.readableName())}, @@ -376,6 +374,12 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { // if not then check whether it is a configurable problem switch(problemId){ + case IProblem.PHPVarDeprecatedWarning : + return this.options.getSeverity(CompilerOptions.PHPVarDeprecatedWarning); + case IProblem.PHPBadStyleKeywordWarning : + return this.options.getSeverity(CompilerOptions.PHPBadStyleKeywordWarning); + case IProblem.PHPBadStyleUppercaseIdentifierWarning : + return this.options.getSeverity(CompilerOptions.PHPBadStyleUppercaseIdentifierWarning); case IProblem.MaskedCatch : return this.options.getSeverity(CompilerOptions.MaskedCatchBlock); @@ -554,11 +558,11 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { // expression.sourceStart, // expression.sourceEnd); //} - public void conflictingImport(ImportReference importRef) { - String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; - this.handle(IProblem.ConflictingImport, arguments, arguments, - importRef.sourceStart, importRef.sourceEnd); - } +// public void conflictingImport(ImportReference importRef) { +// String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; +// this.handle(IProblem.ConflictingImport, arguments, arguments, +// importRef.sourceStart, importRef.sourceEnd); +// } public void constantOutOfFormat(NumberLiteral lit) { // the literal is not in a correct format // this code is called on IntLiteral and LongLiteral @@ -649,11 +653,11 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { new String(type.shortReadableName()), fieldDecl.name()}, fieldDecl.sourceStart, fieldDecl.sourceEnd); } - public void duplicateImport(ImportReference importRef) { - String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; - this.handle(IProblem.DuplicateImport, arguments, arguments, - importRef.sourceStart, importRef.sourceEnd); - } +// public void duplicateImport(ImportReference importRef) { +// String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; +// this.handle(IProblem.DuplicateImport, arguments, arguments, +// importRef.sourceStart, importRef.sourceEnd); +// } public void duplicateInitializationOfBlankFinalField(FieldBinding field, Reference reference) { String[] arguments = new String[]{new String(field.readableName())}; @@ -1050,48 +1054,48 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { this.handle(IProblem.InvalidVoidExpression, NoArgument, NoArgument, location.sourceStart, location.sourceEnd); } - public void importProblem(ImportReference importRef, Binding expectedImport) { - int problemId = expectedImport.problemId(); - int id; - switch (problemId) { - case NotFound : - // 1 - id = IProblem.ImportNotFound; - break; - case NotVisible : - // 2 - id = IProblem.ImportNotVisible; - break; - case Ambiguous : - // 3 - id = IProblem.ImportAmbiguous; - break; - case InternalNameProvided : - // 4 - id = IProblem.ImportInternalNameProvided; - break; - case InheritedNameHidesEnclosingName : - // 5 - id = IProblem.ImportInheritedNameHidesEnclosingName; - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - return; - } - String argument; - if (expectedImport instanceof ProblemReferenceBinding) { - argument = CharOperation - .toString(((ProblemReferenceBinding) expectedImport).compoundName); - } else { - argument = CharOperation.toString(importRef.tokens); - } - String[] arguments = new String[]{argument}; - this.handle(id, arguments, arguments, importRef.sourceStart, - importRef.sourceEnd); - } +// public void importProblem(ImportReference importRef, Binding expectedImport) { +// int problemId = expectedImport.problemId(); +// int id; +// switch (problemId) { +// case NotFound : +// // 1 +// id = IProblem.ImportNotFound; +// break; +// case NotVisible : +// // 2 +// id = IProblem.ImportNotVisible; +// break; +// case Ambiguous : +// // 3 +// id = IProblem.ImportAmbiguous; +// break; +// case InternalNameProvided : +// // 4 +// id = IProblem.ImportInternalNameProvided; +// break; +// case InheritedNameHidesEnclosingName : +// // 5 +// id = IProblem.ImportInheritedNameHidesEnclosingName; +// break; +// case NoError : +// // 0 +// default : +// needImplementation(); // want to fail to see why we were +// // here... +// return; +// } +// String argument; +// if (expectedImport instanceof ProblemReferenceBinding) { +// argument = CharOperation +// .toString(((ProblemReferenceBinding) expectedImport).compoundName); +// } else { +// argument = CharOperation.toString(importRef.tokens); +// } +// String[] arguments = new String[]{argument}; +// this.handle(id, arguments, arguments, importRef.sourceStart, +// importRef.sourceEnd); +// } public void incompatibleExceptionInThrowsClause(SourceTypeBinding type, MethodBinding currentMethod, MethodBinding inheritedMethod, ReferenceBinding exceptionType) { @@ -1954,13 +1958,13 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { new String(inheritedMethod.declaringClass.shortReadableName())}, localMethod.sourceStart(), localMethod.sourceEnd()); } - public void packageCollidesWithType(CompilationUnitDeclaration compUnitDecl) { - String[] arguments = new String[]{CharOperation - .toString(compUnitDecl.currentPackage.tokens)}; - this.handle(IProblem.PackageCollidesWithType, arguments, arguments, - compUnitDecl.currentPackage.sourceStart, - compUnitDecl.currentPackage.sourceEnd); - } +// public void packageCollidesWithType(CompilationUnitDeclaration compUnitDecl) { +// String[] arguments = new String[]{CharOperation +// .toString(compUnitDecl.currentPackage.tokens)}; +// this.handle(IProblem.PackageCollidesWithType, arguments, arguments, +// compUnitDecl.currentPackage.sourceStart, +// compUnitDecl.currentPackage.sourceEnd); +// } public void packageIsNotExpectedPackage( CompilationUnitDeclaration compUnitDecl) { String[] arguments = new String[]{CharOperation @@ -2439,11 +2443,11 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { this.handle(IProblem.ArgumentIsNeverUsed, arguments, arguments, localDecl.sourceStart, localDecl.sourceEnd); } - public void unusedImport(ImportReference importRef) { - String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; - this.handle(IProblem.UnusedImport, arguments, arguments, - importRef.sourceStart, importRef.sourceEnd); - } +// public void unusedImport(ImportReference importRef) { +// String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; +// this.handle(IProblem.UnusedImport, arguments, arguments, +// importRef.sourceStart, importRef.sourceEnd); +// } public void unusedLocalVariable(LocalDeclaration localDecl) { String[] arguments = new String[]{localDecl.name()}; this.handle(IProblem.LocalVariableIsNeverUsed, arguments, arguments, @@ -2701,7 +2705,27 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { public void phpVarDeprecatedWarning( int problemStartPosition, int problemEndPosition, ReferenceContext context, CompilationResult compilationResult) { + if (computeSeverity(IProblem.PHPVarDeprecatedWarning) == Ignore) + return; this.handle(IProblem.PHPVarDeprecatedWarning, NoArgument, new String[]{}, problemStartPosition, problemEndPosition, context, compilationResult); } + + public void phpKeywordWarning(String[] messageArguments, + int problemStartPosition, int problemEndPosition, + ReferenceContext context, CompilationResult compilationResult) { + if (computeSeverity(IProblem.PHPBadStyleKeywordWarning) == Ignore) + return; + this.handle(IProblem.PHPBadStyleKeywordWarning, NoArgument, messageArguments, + problemStartPosition, problemEndPosition, context, compilationResult); + } + + public void phpUppercaseIdentifierWarning( + int problemStartPosition, int problemEndPosition, + ReferenceContext context, CompilationResult compilationResult) { + if (computeSeverity(IProblem.PHPBadStyleUppercaseIdentifierWarning) == Ignore) + return; + this.handle(IProblem.PHPBadStyleUppercaseIdentifierWarning, NoArgument, new String[]{}, + problemStartPosition, problemEndPosition, context, compilationResult); + } }