### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java,v retrieving revision 1.106 diff -u -r1.106 ASTNode.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 17 Dec 2010 09:38:55 -0000 1.106 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 1 Feb 2011 14:30:30 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -163,6 +163,9 @@ // for all method/constructor invocations (msg, alloc, expl. constr call) public static final int Unchecked = Bit17; + // for javadoc - used to indicate whether the javadoc has to be resolved + public static final int ResolveJavadoc = Bit17; + // for empty statement public static final int IsUsefulEmptyStatement = Bit1; Index: compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java,v retrieving revision 1.70 diff -u -r1.70 Javadoc.java --- compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 1 Nov 2010 14:15:47 -0000 1.70 +++ compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 1 Feb 2011 14:30:30 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,6 +38,7 @@ public Javadoc(int sourceStart, int sourceEnd) { this.sourceStart = sourceStart; this.sourceEnd = sourceEnd; + this.bits |= ASTNode.ResolveJavadoc; } /** * Returns whether a type can be seen at a given visibility level or not. @@ -184,6 +185,9 @@ * Resolve type javadoc */ public void resolve(ClassScope scope) { + if ((this.bits & ASTNode.ResolveJavadoc) == 0) { + return; + } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=247037, @inheritDoc tag cannot // be used in the documentation comment for a class or interface. if (this.inheritedPositions != null) { @@ -244,6 +248,9 @@ * Resolve compilation unit javadoc */ public void resolve(CompilationUnitScope unitScope) { + if ((this.bits & ASTNode.ResolveJavadoc) == 0) { + return; + } // Do nothing - This is to mimic the SDK's javadoc tool behavior, which neither // sanity checks nor generates documentation using comments at the CU scope // (unless the unit happens to be package-info.java - in which case we don't come here.) @@ -253,7 +260,9 @@ * Resolve method javadoc */ public void resolve(MethodScope methScope) { - + if ((this.bits & ASTNode.ResolveJavadoc) == 0) { + return; + } // get method declaration AbstractMethodDeclaration methDecl = methScope.referenceMethod(); boolean overriding = methDecl == null /* field declaration */ || methDecl.binding == null /* compiler error */ Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v retrieving revision 1.241 diff -u -r1.241 CompilerOptions.java --- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 16 Jan 2011 22:43:21 -0000 1.241 +++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 1 Feb 2011 14:30:31 -0000 @@ -1500,7 +1500,6 @@ if (ENABLED.equals(optionValue)) { this.processAnnotations = true; this.storeAnnotations = true; // annotation processing requires annotation to be stored - this.docCommentSupport = true; // annotation processing requires javadoc processing } else if (DISABLED.equals(optionValue)) { this.processAnnotations = false; this.storeAnnotations = false; Index: compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java,v retrieving revision 1.94 diff -u -r1.94 AbstractCommentParser.java --- compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 9 Feb 2010 09:12:42 -0000 1.94 +++ compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 1 Feb 2011 14:30:32 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -48,6 +48,7 @@ // Options public boolean checkDocComment = false; + public boolean setJavadocPositions = false; public boolean reportProblems; protected long complianceLevel; protected long sourceLevel; 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.79 diff -u -r1.79 JavadocParser.java --- compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 24 Apr 2009 13:06:53 -0000 1.79 +++ compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java 1 Feb 2011 14:30:32 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -46,6 +46,9 @@ public JavadocParser(Parser sourceParser) { super(sourceParser); this.kind = COMPIL_PARSER | TEXT_VERIF; + if (sourceParser != null && sourceParser.options != null) { + this.setJavadocPositions = sourceParser.options.processAnnotations; + } } /* (non-Javadoc) @@ -67,6 +70,12 @@ // Init javadoc if necessary if (this.checkDocComment) { this.docComment = new Javadoc(this.javadocStart, this.javadocEnd); + } else if (this.setJavadocPositions) { + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=189459 + // if annotation processors are there, javadoc object is required but + // they need not be resolved + this.docComment = new Javadoc(this.javadocStart, this.javadocEnd); + this.docComment.bits &= ~ASTNode.ResolveJavadoc; } else { this.docComment = null; } #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java,v retrieving revision 1.72 diff -u -r1.72 JavadocBugsTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 22 Oct 2010 22:42:32 -0000 1.72 +++ src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java 1 Feb 2011 14:30:44 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,6 +30,7 @@ String reportMissingJavadocCommentsVisibility = null; String reportDeprecation = CompilerOptions.ERROR; String reportJavadocDeprecation = null; + String processAnnotations = null; public JavadocBugsTest(String name) { super(name); @@ -80,6 +81,9 @@ if (this.reportMissingJavadocDescription != null) { options.put(CompilerOptions.OPTION_ReportMissingJavadocTagDescription, this.reportMissingJavadocDescription); } + if (this.processAnnotations != null) { + options.put(CompilerOptions.OPTION_Process_Annotations, this.processAnnotations); + } options.put(CompilerOptions.OPTION_ReportFieldHiding, CompilerOptions.IGNORE); options.put(CompilerOptions.OPTION_ReportSyntheticAccessEmulation, CompilerOptions.IGNORE); options.put(CompilerOptions.OPTION_ReportDeprecation, this.reportDeprecation); @@ -8631,5 +8635,22 @@ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError ); } - +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=316782 +// Test to verify that turning on process annotations doesn't turn on javadoc check +public void testBug316782() { + if (this.complianceLevel < ClassFileConstants.JDK1_5) { + return; + } + this.processAnnotations = CompilerOptions.ENABLED; + this.docCommentSupport = CompilerOptions.DISABLED; + runConformTest( + new String[] { + "X.java", + "/** @see X.XX.XXX */\n" + + "public class X {\n" + + "/** @see X.XX.XXX */\n" + + " public void foo() { }\n" + + "}\n" + }); +} } \ No newline at end of file