Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 79197 Details for
Bug 192449
[javadoc][assist] SelectionJavadocParser should not report problems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
[proposed patch + test case] on top v815 - all jdt.core tests OK
b192449_on_top_HEAD(v814)_v16.txt (text/plain), 25.04 KB, created by
Eric Jodet
on 2007-09-26 07:57:58 EDT
(
hide
)
Description:
[proposed patch + test case] on top v815 - all jdt.core tests OK
Filename:
MIME Type:
Creator:
Eric Jodet
Created:
2007-09-26 07:57:58 EDT
Size:
25.04 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java,v >retrieving revision 1.376 >diff -u -r1.376 Parser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 31 Jul 2007 19:08:58 -0000 1.376 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 26 Sep 2007 11:51:09 -0000 >@@ -1111,9 +1111,11 @@ > // check deprecation in last comment if javadoc (can be followed by non-javadoc comments which are simply ignored) > while (lastComment >= 0 && this.scanner.commentStops[lastComment] < 0) lastComment--; // non javadoc comment have negative end positions > if (lastComment >= 0 && this.javadocParser != null) { >- int commentEnd = this.scanner.commentStops[lastComment] - 1; //stop is one over, >+ int commentEnd = this.scanner.commentStops[lastComment] - 1; //stop is one over > // do not report problem before last parsed comment while recovering code... >- this.javadocParser.reportProblems = this.currentElement == null || commentEnd > this.lastJavadocEnd; >+ if (this.javadocParser.shouldReportProblems) { >+ this.javadocParser.reportProblems = this.currentElement == null || commentEnd > this.lastJavadocEnd; >+ } > if (this.javadocParser.checkDeprecation(lastComment)) { > checkAndSetModifiers(ClassFileConstants.AccDeprecated); > } >@@ -10387,4 +10389,5 @@ > exp.sourceEnd = this.intStack[this.intPtr--]; > exp.sourceStart = this.intStack[this.intPtr--]; > } >+ > } >Index: compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java,v >retrieving revision 1.63 >diff -u -r1.63 JavadocParser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 27 Apr 2007 15:51:39 -0000 1.63 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 26 Sep 2007 11:51:07 -0000 >@@ -34,6 +34,10 @@ > // bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=153399 > // Store value tag positions > private long validValuePositions, invalidValuePositions; >+ >+ // returns whether this JavadocParser shuold report errors or not (overrides reportProblems) >+ // see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=192449" >+ public boolean shouldReportProblems = true; > > public JavadocParser(Parser sourceParser) { > super(sourceParser); >Index: model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java,v >retrieving revision 1.23 >diff -u -r1.23 CommentRecorderParser.java >--- model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java 27 Apr 2007 15:51:39 -0000 1.23 >+++ model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java 26 Sep 2007 11:51:09 -0000 >@@ -63,11 +63,13 @@ > } > checkDeprecated = true; > int commentSourceEnd = this.scanner.commentStops[lastCommentIndex] - 1; //stop is one over >- > // do not report problem before last parsed comment while recovering code... >- this.javadocParser.reportProblems = this.currentElement == null || commentSourceEnd > this.lastJavadocEnd; >+ if (this.javadocParser.shouldReportProblems) { >+ this.javadocParser.reportProblems = this.currentElement == null || commentSourceEnd > this.lastJavadocEnd; >+ } > deprecated = this.javadocParser.checkDeprecation(lastCommentIndex); > this.javadoc = this.javadocParser.docComment; >+ if (currentElement == null) this.lastJavadocEnd = commentSourceEnd; > break nextComment; > } > if (deprecated) { >Index: model/org/eclipse/jdt/internal/compiler/SourceElementParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java,v >retrieving revision 1.75 >diff -u -r1.75 SourceElementParser.java >--- model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 23 Jul 2007 18:42:09 -0000 1.75 >+++ model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 26 Sep 2007 11:51:09 -0000 >@@ -176,9 +176,11 @@ > // check deprecation in last comment if javadoc (can be followed by non-javadoc comments which are simply ignored) > while (lastComment >= 0 && this.scanner.commentStops[lastComment] < 0) lastComment--; // non javadoc comment have negative end positions > if (lastComment >= 0 && this.javadocParser != null) { >- int commentEnd = this.scanner.commentStops[lastComment] - 1; //stop is one over, >+ int commentEnd = this.scanner.commentStops[lastComment] - 1; //stop is one over > // do not report problem before last parsed comment while recovering code... >- this.javadocParser.reportProblems = this.currentElement == null || commentEnd > this.lastJavadocEnd; >+ if (this.javadocParser.shouldReportProblems) { >+ this.javadocParser.reportProblems = this.currentElement == null || commentEnd > this.lastJavadocEnd; >+ } > if (this.javadocParser.checkDeprecation(lastComment)) { > checkAndSetModifiers(ClassFileConstants.AccDeprecated); > } >Index: codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java,v >retrieving revision 1.5 >diff -u -r1.5 SelectionJavadocParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java 6 Mar 2007 02:38:50 -0000 1.5 >+++ codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java 26 Sep 2007 11:51:07 -0000 >@@ -28,6 +28,7 @@ > > public SelectionJavadocParser(SelectionParser sourceParser) { > super(sourceParser); >+ this.shouldReportProblems = false; > this.kind = SELECTION_PARSER | TEXT_PARSE; > } > >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/parser/SelectionJavadocTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionJavadocTest.java,v >retrieving revision 1.5 >diff -u -r1.5 SelectionJavadocTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/SelectionJavadocTest.java 29 Mar 2006 03:50:23 -0000 1.5 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/SelectionJavadocTest.java 26 Sep 2007 11:51:11 -0000 >@@ -11,30 +11,21 @@ > package org.eclipse.jdt.core.tests.compiler.parser; > > import java.util.Locale; >+import java.util.Map; >+ >+import junit.framework.Test; > > import org.eclipse.jdt.core.tests.util.Util; >-import org.eclipse.jdt.internal.codeassist.select.SelectionJavadoc; > import org.eclipse.jdt.internal.codeassist.select.SelectionParser; >-import org.eclipse.jdt.internal.compiler.ASTVisitor; > import org.eclipse.jdt.internal.compiler.CompilationResult; > import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; > import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; >-import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; >-import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; >-import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; >-import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; > import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; > import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; >-import org.eclipse.jdt.internal.compiler.lookup.BlockScope; >-import org.eclipse.jdt.internal.compiler.lookup.ClassScope; >-import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope; >-import org.eclipse.jdt.internal.compiler.lookup.MethodScope; > import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; > import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; > >-import junit.framework.Test; >- > /** > * Class to test selection in Javadoc comments. > * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=54968" >@@ -42,7 +33,6 @@ > public class SelectionJavadocTest extends AbstractSelectionTest { > > String source; >- StringBuffer result; > ICompilationUnit unit; > > public SelectionJavadocTest(String testName) { >@@ -58,57 +48,6 @@ > return buildAllCompliancesTestSuite(SelectionJavadocTest.class); > } > >- class SelectionVisitor extends ASTVisitor { >- >- public boolean visit(ConstructorDeclaration constructor, ClassScope scope) { >- if (constructor.javadoc != null) { >- assertTrue("Invalid type for Javadoc on " + constructor, constructor.javadoc instanceof SelectionJavadoc); >- SelectionJavadocTest.this.result.append(constructor.javadoc.toString()); >- } >- return super.visit(constructor, scope); >- } >- >- public boolean visit(FieldDeclaration field, MethodScope scope) { >- if (field.javadoc != null) { >- assertTrue("Invalid type for Javadoc on " + field, field.javadoc instanceof SelectionJavadoc); >- SelectionJavadocTest.this.result.append(field.javadoc.toString()); >- } >- return super.visit(field, scope); >- } >- >- public boolean visit(MethodDeclaration method, ClassScope scope) { >- if (method.javadoc != null) { >- assertTrue("Invalid type for Javadoc on " + method, method.javadoc instanceof SelectionJavadoc); >- SelectionJavadocTest.this.result.append(method.javadoc.toString()); >- } >- return super.visit(method, scope); >- } >- >- public boolean visit(TypeDeclaration type, BlockScope scope) { >- if (type.javadoc != null) { >- assertTrue("Invalid type for Javadoc on " + type, type.javadoc instanceof SelectionJavadoc); >- SelectionJavadocTest.this.result.append(type.javadoc.toString()); >- } >- return super.visit(type, scope); >- } >- >- public boolean visit(TypeDeclaration type, ClassScope scope) { >- if (type.javadoc != null) { >- assertTrue("Invalid type for Javadoc on " + type, type.javadoc instanceof SelectionJavadoc); >- SelectionJavadocTest.this.result.append(type.javadoc.toString()); >- } >- return super.visit(type, scope); >- } >- >- public boolean visit(TypeDeclaration type, CompilationUnitScope scope) { >- if (type.javadoc != null) { >- assertTrue("Invalid type for Javadoc on " + type, type.javadoc instanceof SelectionJavadoc); >- SelectionJavadocTest.this.result.append(type.javadoc.toString()); >- } >- return super.visit(type, scope); >- } >- } >- > protected void assertValid(String expected) { > String actual = this.result.toString(); > if (!actual.equals(expected)) { >@@ -163,7 +102,7 @@ > // Visit compilation unit declaration to find javadoc > unitDecl.traverse(new SelectionVisitor(), unitDecl.scope); > } >- >+ > public void test01() { > setUnit("Test.java", > "public class Test {\n" + >@@ -861,4 +800,31 @@ > "/**<SelectOnType:Other>*/\n" > ); > } >+ >+ /** >+ * @bug 192449: [javadoc][assist] SelectionJavadocParser should not report problems >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=192449" >+ */ >+ public void test26() { >+ setUnit("Test.java", >+ "public class Test {\n" + >+ " public void bar() {\n" + >+ " new Object() {\n" + >+ " /**\n" + >+ " * @see \n" + >+ " * @see Test\n" + >+ " * @see Other\n" + >+ " */\n" + >+ " public class Other {}\n" + >+ " };\n" + >+ " }\n" + >+ "}" >+ ); >+ Map optionsMap = getCompilerOptions(); >+ optionsMap.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); >+ optionsMap.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.WARNING); >+ optionsMap.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ENABLED); >+ optionsMap.put(CompilerOptions.OPTION_ReportMissingJavadoc, CompilerOptions.WARNING); >+ runTestParseCompilationUnit(this.unit, "NoReference", optionsMap, ""); // SelectionJavadocParser should not report errors >+ } > } >Index: src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java,v >retrieving revision 1.17 >diff -u -r1.17 AbstractSelectionTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java 10 May 2006 18:07:26 -0000 1.17 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java 26 Sep 2007 11:51:11 -0000 >@@ -11,33 +11,95 @@ > package org.eclipse.jdt.core.tests.compiler.parser; > > import java.util.Locale; >+import java.util.Map; > >+import org.eclipse.jdt.core.compiler.CharOperation; >+import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; >+import org.eclipse.jdt.core.tests.util.Util; >+import org.eclipse.jdt.internal.codeassist.select.SelectionJavadoc; > import org.eclipse.jdt.internal.codeassist.select.SelectionParser; > import org.eclipse.jdt.internal.codeassist.select.SelectionScanner; >+import org.eclipse.jdt.internal.compiler.ASTVisitor; > import org.eclipse.jdt.internal.compiler.CompilationResult; > import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; >-import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; > import org.eclipse.jdt.internal.compiler.ast.ASTNode; >+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; > import org.eclipse.jdt.internal.compiler.ast.Block; > import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; > import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; > import org.eclipse.jdt.internal.compiler.ast.Initializer; >+import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; > import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; > import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; > import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; >+import org.eclipse.jdt.internal.compiler.lookup.BlockScope; >+import org.eclipse.jdt.internal.compiler.lookup.ClassScope; >+import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope; >+import org.eclipse.jdt.internal.compiler.lookup.MethodScope; > import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; > import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; >-import org.eclipse.jdt.core.compiler.CharOperation; >-import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; >-import org.eclipse.jdt.core.tests.util.Util; > > public abstract class AbstractSelectionTest extends AbstractCompilerTest { > > public final static String NONE = "<NONE>"; >+ protected StringBuffer result; >+ > public AbstractSelectionTest(String testName){ > super(testName); > } >+ >+ class SelectionVisitor extends ASTVisitor { >+ >+ public boolean visit(ConstructorDeclaration constructor, ClassScope scope) { >+ if (constructor.javadoc != null) { >+ assertTrue("Invalid type for Javadoc on " + constructor, constructor.javadoc instanceof SelectionJavadoc); >+ AbstractSelectionTest.this.result.append(constructor.javadoc.toString()); >+ } >+ return super.visit(constructor, scope); >+ } >+ >+ public boolean visit(FieldDeclaration field, MethodScope scope) { >+ if (field.javadoc != null) { >+ assertTrue("Invalid type for Javadoc on " + field, field.javadoc instanceof SelectionJavadoc); >+ AbstractSelectionTest.this.result.append(field.javadoc.toString()); >+ } >+ return super.visit(field, scope); >+ } >+ >+ public boolean visit(MethodDeclaration method, ClassScope scope) { >+ if (method.javadoc != null) { >+ assertTrue("Invalid type for Javadoc on " + method, method.javadoc instanceof SelectionJavadoc); >+ AbstractSelectionTest.this.result.append(method.javadoc.toString()); >+ } >+ return super.visit(method, scope); >+ } >+ >+ public boolean visit(TypeDeclaration type, BlockScope scope) { >+ if (type.javadoc != null) { >+ assertTrue("Invalid type for Javadoc on " + type, type.javadoc instanceof SelectionJavadoc); >+ AbstractSelectionTest.this.result.append(type.javadoc.toString()); >+ } >+ return super.visit(type, scope); >+ } >+ >+ public boolean visit(TypeDeclaration type, ClassScope scope) { >+ if (type.javadoc != null) { >+ assertTrue("Invalid type for Javadoc on " + type, type.javadoc instanceof SelectionJavadoc); >+ AbstractSelectionTest.this.result.append(type.javadoc.toString()); >+ } >+ return super.visit(type, scope); >+ } >+ >+ public boolean visit(TypeDeclaration type, CompilationUnitScope scope) { >+ if (type.javadoc != null) { >+ assertTrue("Invalid type for Javadoc on " + type, type.javadoc instanceof SelectionJavadoc); >+ AbstractSelectionTest.this.result.append(type.javadoc.toString()); >+ } >+ return super.visit(type, scope); >+ } >+ } > /* > * DietParse with selectionNode check > */ >@@ -327,4 +389,35 @@ > expectedReplacedSource, > testName); > } >+ >+ protected void runTestParseCompilationUnit(ICompilationUnit unit, String selection, Map customOptions, String expectedResult) { >+ // Verify params >+ assertNotNull("Missing source!", unit); >+ assertNotNull("Missing selection!", selection); >+ >+ // enable custom options if any >+ Map currentOptionsMap = getCompilerOptions(); >+ if (customOptions != null) { >+ currentOptionsMap.putAll(customOptions); >+ } >+ CompilerOptions options = new CompilerOptions(currentOptionsMap); >+ >+ // Get selection start and end >+ int selectionStart = CharOperation.indexOf(selection.toCharArray(), unit.getContents(), true); >+ int length = selection.length(); >+ int selectionEnd = selectionStart + length - 1; >+ >+ // Parse unit >+ SelectionParser parser = new SelectionParser(new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(), >+ options, >+ new DefaultProblemFactory(Locale.getDefault()))); >+ CompilationUnitDeclaration unitDecl = parser.dietParse(unit, new CompilationResult(unit, 0, 0, 0), selectionStart, selectionEnd); >+ parser.getMethodBodies(unitDecl); >+ >+ // Visit compilation unit declaration to find javadoc >+ unitDecl.traverse(new SelectionVisitor(), unitDecl.scope); >+ >+ // check results >+ assertEquals(expectedResult, Util.getProblemLog(unitDecl.compilationResult, false, false)); >+ } > } >Index: src/org/eclipse/jdt/core/tests/util/Util.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java,v >retrieving revision 1.57 >diff -u -r1.57 Util.java >--- src/org/eclipse/jdt/core/tests/util/Util.java 5 Jul 2007 15:11:25 -0000 1.57 >+++ src/org/eclipse/jdt/core/tests/util/Util.java 26 Sep 2007 11:51:11 -0000 >@@ -20,8 +20,10 @@ > import org.eclipse.core.resources.IContainer; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.jdt.core.compiler.CategorizedProblem; > import org.eclipse.jdt.core.compiler.IProblem; > import org.eclipse.jdt.core.tests.compiler.regression.Requestor; >+import org.eclipse.jdt.internal.compiler.CompilationResult; > import org.eclipse.jdt.internal.compiler.Compiler; > import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy; > import org.eclipse.jdt.internal.compiler.IProblemFactory; >@@ -31,6 +33,7 @@ > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.problem.DefaultProblem; > import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; >+import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; > public class Util { > // Trace for delete operation > /* >@@ -1230,4 +1233,55 @@ > } > } > } >+/** >+ * Returns the compilation errors / warnings for the given CompilationResult. >+ * >+ * @param compilationResult the compilation result >+ * @param showCategory >+ * @param showWarningToken >+ * @return String the problem log >+ */ >+public static String getProblemLog(CompilationResult compilationResult, boolean showCategory, boolean showWarningToken) { >+ StringBuffer buffer = new StringBuffer(100); >+ if (compilationResult.hasProblems() || compilationResult.hasTasks()) { >+ CategorizedProblem[] problems = compilationResult.getAllProblems(); >+ int count = problems.length; >+ int problemCount = 0; >+ char[] unitSource = compilationResult.compilationUnit.getContents(); >+ for (int i = 0; i < count; i++) { >+ DefaultProblem problem = (DefaultProblem) problems[i]; >+ if (problem != null) { >+ if (problemCount == 0) >+ buffer.append("----------\n"); >+ problemCount++; >+ buffer.append(problemCount + (problem.isError() ? ". ERROR" : ". WARNING")); >+ buffer.append(" in " + new String(problem.getOriginatingFileName()).replace('/', '\\')); >+ try { >+ buffer.append(problem.errorReportSource(unitSource)); >+ buffer.append("\n"); >+ if (showCategory) { >+ String category = problem.getInternalCategoryMessage(); >+ if (category != null) { >+ buffer.append("[@cat:").append(category).append("] "); >+ } >+ } >+ if (showWarningToken) { >+ long irritant = ProblemReporter.getIrritant(problem.getID()); >+ if (irritant != 0) { >+ String warningToken = CompilerOptions.warningTokenFromIrritant(irritant); >+ if (warningToken != null) { >+ buffer.append("[@sup:").append(warningToken).append("] "); >+ } >+ } >+ } >+ buffer.append(problem.getMessage()); >+ buffer.append("\n"); >+ } catch (Exception e) { >+ } >+ buffer.append("----------\n"); >+ } >+ } >+ } >+ return buffer.toString(); >+} > } >Index: src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java,v >retrieving revision 1.16 >diff -u -r1.16 Requestor.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java 29 Mar 2006 03:50:23 -0000 1.16 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java 26 Sep 2007 11:51:11 -0000 >@@ -16,14 +16,11 @@ > > import junit.framework.Assert; > >-import org.eclipse.jdt.core.compiler.CategorizedProblem; >+import org.eclipse.jdt.core.tests.util.Util; > import org.eclipse.jdt.internal.compiler.ClassFile; > import org.eclipse.jdt.internal.compiler.CompilationResult; > import org.eclipse.jdt.internal.compiler.ICompilerRequestor; > import org.eclipse.jdt.internal.compiler.IProblemFactory; >-import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; >-import org.eclipse.jdt.internal.compiler.problem.DefaultProblem; >-import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; > > public class Requestor extends Assert implements ICompilerRequestor { > public boolean hasErrors = false; >@@ -45,48 +42,8 @@ > this.showWarningToken = showWarningToken; > } > public void acceptResult(CompilationResult compilationResult) { >- StringBuffer buffer = new StringBuffer(100); >- hasErrors |= compilationResult.hasErrors(); >- if (compilationResult.hasProblems() || compilationResult.hasTasks()) { >- CategorizedProblem[] problems = compilationResult.getAllProblems(); >- int count = problems.length; >- int problemCount = 0; >- char[] unitSource = compilationResult.compilationUnit.getContents(); >- for (int i = 0; i < count; i++) { >- DefaultProblem problem = (DefaultProblem) problems[i]; >- if (problem != null) { >- if (problemCount == 0) >- buffer.append("----------\n"); >- problemCount++; >- buffer.append(problemCount + (problem.isError() ? ". ERROR" : ". WARNING")); >- buffer.append(" in " + new String(problem.getOriginatingFileName()).replace('/', '\\')); >- try { >- buffer.append(problem.errorReportSource(unitSource)); >- buffer.append("\n"); >- if (showCategory) { >- String category = problem.getInternalCategoryMessage(); >- if (category != null) { >- buffer.append("[@cat:").append(category).append("] "); >- } >- } >- if (showWarningToken) { >- long irritant = ProblemReporter.getIrritant(problem.getID()); >- if (irritant != 0) { >- String warningToken = CompilerOptions.warningTokenFromIrritant(irritant); >- if (warningToken != null) { >- buffer.append("[@sup:").append(warningToken).append("] "); >- } >- } >- } >- buffer.append(problem.getMessage()); >- buffer.append("\n"); >- } catch (Exception e) { >- } >- buffer.append("----------\n"); >- } >- } >- problemLog += buffer.toString(); >- } >+ this.hasErrors |= compilationResult.hasErrors(); >+ this.problemLog += Util.getProblemLog(compilationResult, this.showCategory, this.showWarningToken); > outputClassFiles(compilationResult); > if (this.clientRequestor != null) { > this.clientRequestor.acceptResult(compilationResult);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 192449
:
73534
|
77115
|
78276
|
78959
|
79054
|
79197
|
79265
|
79366