View | Details | Raw Unified | Return to bug 233187 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java (+12 lines)
Lines 49-54 Link Here
49
					scope.problemReporter().javadocInvalidMemberTypeQualification(this.sourceStart, this.sourceEnd, scope.getDeclarationModifiers());
49
					scope.problemReporter().javadocInvalidMemberTypeQualification(this.sourceStart, this.sourceEnd, scope.getDeclarationModifiers());
50
					// https://bugs.eclipse.org/bugs/show_bug.cgi?id=228648
50
					// https://bugs.eclipse.org/bugs/show_bug.cgi?id=228648
51
					// do not return now but report unresolved reference as expected depending on compliance settings
51
					// do not return now but report unresolved reference as expected depending on compliance settings
52
				} else if (typeRef instanceof QualifiedTypeReference) {
53
					TypeBinding enclosingType = this.resolvedType.leafComponentType().enclosingType();
54
					if (enclosingType != null) {
55
						// https://bugs.eclipse.org/bugs/show_bug.cgi?id=233187
56
						// inner type references should be fully qualified
57
						int compoundLength = 2;
58
						while ((enclosingType = enclosingType.enclosingType()) != null) compoundLength++;
59
						compoundLength+=this.resolvedType.getPackage().compoundName.length;
60
						if (typeRef.getTypeName().length != compoundLength) {
61
							scope.problemReporter().javadocInvalidMemberTypeQualification(typeRef.sourceStart, typeRef.sourceEnd, scope.getDeclarationModifiers());
62
						}
63
					}
52
				}
64
				}
53
				if (!this.resolvedType.isValidBinding()) {
65
				if (!this.resolvedType.isValidBinding()) {
54
					scope.problemReporter().javadocInvalidType(typeRef, this.resolvedType, scope.getDeclarationModifiers());
66
					scope.problemReporter().javadocInvalidType(typeRef, this.resolvedType, scope.getDeclarationModifiers());
(-)src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java (+116 lines)
Lines 7745-7750 Link Here
7745
}
7745
}
7746
7746
7747
/**
7747
/**
7748
 * @bug 233187: [javadoc] partially qualified inner types  should be warned
7749
 * @test verify that partial inner class qualification are warned as javadoc tools does
7750
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=233187"
7751
 */
7752
public void testBug233187a() {
7753
	String[] units = new String[] {
7754
		"X.java",
7755
		"package test.bug;\n" + 
7756
		"\n" + 
7757
		"public class X {\n" + 
7758
		"   public static class Y {\n" + 
7759
		"        public static class Z { \n" + 
7760
		"            /**\n" + 
7761
		"             * The position in the new method signature depends on\n" + 
7762
		"             * the position in the array passed to\n" + 
7763
		"             * {@link X.Y#foo(test.bug.X.Y.Z[])} OK for javadoc tool\n" + 
7764
		"             * {@link X.Y#foo(test.bug.X.Y.Z)} KO for javadoc tool\n" + 
7765
		"             * {@link X.Y#foo(no_test.bug.X.Y.Z[])} KO for javadoc tool\n" + 
7766
		"             * {@link X.Y#foo(Y.Z[])} KO for javadoc tool\n" + 
7767
		"             * {@link test.bug.X.Y#foo(Y.Z[])} KO for javadoc tool\n" + 
7768
		"             */\n" + 
7769
		"            public int bar() {\n" + 
7770
		"                return 0;\n" + 
7771
		"            }\n" + 
7772
		"        }\n" + 
7773
		"\n" + 
7774
		"        public void foo(Z[] params) {\n" + 
7775
		"        }\n" + 
7776
		"    }\n" + 
7777
		"}\n"
7778
	};
7779
	runNegativeTest(units,
7780
		// warning - Tag @link: can't find foo(test.bug.X.Y.Z) in test.bug.X.Y
7781
		// warning - Tag @link: can't find foo(no_test.bug.X.Y.Z[]) in test.bug.X.Y
7782
		// warning - Tag @link: can't find foo(Y.Z[]) in test.bug.X.Y
7783
		// warning - Tag @link: can't find foo(Y.Z[]) in test.bug.X.Y
7784
		"----------\n" + 
7785
		"1. ERROR in X.java (at line 10)\n" + 
7786
		"	* {@link X.Y#foo(test.bug.X.Y.Z)} KO for javadoc tool\n" + 
7787
		"	             ^^^\n" + 
7788
		"Javadoc: The method foo(X.Y.Z[]) in the type X.Y is not applicable for the arguments (X.Y.Z)\n" + 
7789
		"----------\n" + 
7790
		"2. ERROR in X.java (at line 11)\n" + 
7791
		"	* {@link X.Y#foo(no_test.bug.X.Y.Z[])} KO for javadoc tool\n" + 
7792
		"	                 ^^^^^^^^^^^^^^^^^\n" + 
7793
		"Javadoc: no_test[] cannot be resolved to a type\n" + 
7794
		"----------\n" + 
7795
		"3. ERROR in X.java (at line 12)\n" + 
7796
		"	* {@link X.Y#foo(Y.Z[])} KO for javadoc tool\n" + 
7797
		"	                 ^^^\n" + 
7798
		"Javadoc: Invalid member type qualification\n" + 
7799
		"----------\n" + 
7800
		"4. ERROR in X.java (at line 13)\n" + 
7801
		"	* {@link test.bug.X.Y#foo(Y.Z[])} KO for javadoc tool\n" + 
7802
		"	                          ^^^\n" + 
7803
		"Javadoc: Invalid member type qualification\n" + 
7804
		"----------\n"
7805
	);
7806
}
7807
public void testBug233187b() {
7808
	String[] units = new String[] {
7809
		"X.java",
7810
		"package test.bug;\n" + 
7811
		"\n" + 
7812
		"public class X {\n" + 
7813
		"   public static class Y {\n" + 
7814
		"        public static class Z { \n" + 
7815
		"            /**\n" + 
7816
		"             * The position in the new method signature depends on\n" + 
7817
		"             * the position in the array passed to\n" + 
7818
		"             * {@link X.Y#foo(test.bug.X.Y.Z)} OK for javadoc tool\n" +
7819
		"            * {@link X.Y#foo(test.bug.X.Y.Z[])} KO for javadoc tool\n" +
7820
		"             * {@link X.Y#foo(no_test.bug.X.Y.Z)} KO for javadoc tool\n" +
7821
		"             * {@link X.Y#foo(Y.Z)} KO for javadoc tool\n" +
7822
		"             * {@link test.bug.X.Y#foo(Y.Z)} KO for javadoc tool\n" +
7823
		"             */\n" + 
7824
		"            public int bar() {\n" + 
7825
		"                return 0;\n" + 
7826
		"            }\n" + 
7827
		"        }\n" + 
7828
		"\n" + 
7829
		"        public void foo(Z params) {\n" + 
7830
		"        }\n" + 
7831
		"    }\n" + 
7832
		"}\n"
7833
	};
7834
	runNegativeTest(units,
7835
		// warning - Tag @link: can't find foo(test.bug.X.Y.Z[]) in test.bug.X.Y
7836
		// warning - Tag @link: can't find foo(no_test.bug.X.Y.Z) in test.bug.X.Y
7837
		// warning - Tag @link: can't find foo(Y.Z) in test.bug.X.Y
7838
		// warning - Tag @link: can't find foo(Y.Z) in test.bug.X.Y
7839
		"----------\n" + 
7840
		"1. ERROR in X.java (at line 10)\n" + 
7841
		"	* {@link X.Y#foo(test.bug.X.Y.Z[])} KO for javadoc tool\n" + 
7842
		"	             ^^^\n" + 
7843
		"Javadoc: The method foo(X.Y.Z) in the type X.Y is not applicable for the arguments (X.Y.Z[])\n" + 
7844
		"----------\n" + 
7845
		"2. ERROR in X.java (at line 11)\n" + 
7846
		"	* {@link X.Y#foo(no_test.bug.X.Y.Z)} KO for javadoc tool\n" + 
7847
		"	                 ^^^^^^^^^^^^^^^^^\n" + 
7848
		"Javadoc: no_test cannot be resolved to a type\n" + 
7849
		"----------\n" + 
7850
		"3. ERROR in X.java (at line 12)\n" + 
7851
		"	* {@link X.Y#foo(Y.Z)} KO for javadoc tool\n" + 
7852
		"	                 ^^^\n" + 
7853
		"Javadoc: Invalid member type qualification\n" + 
7854
		"----------\n" + 
7855
		"4. ERROR in X.java (at line 13)\n" + 
7856
		"	* {@link test.bug.X.Y#foo(Y.Z)} KO for javadoc tool\n" + 
7857
		"	                          ^^^\n" + 
7858
		"Javadoc: Invalid member type qualification\n" + 
7859
		"----------\n"
7860
	);
7861
}
7862
7863
/**
7748
 * @bug 233887: Build of Eclipse project stop by NullPointerException and will not continue on Eclipse version later than 3.4M7
7864
 * @bug 233887: Build of Eclipse project stop by NullPointerException and will not continue on Eclipse version later than 3.4M7
7749
 * @test Ensure that no NPE is raised when a 1.5 param tag syntax is incorrectly used on a fiel with an initializer
7865
 * @test Ensure that no NPE is raised when a 1.5 param tag syntax is incorrectly used on a fiel with an initializer
7750
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=233887"
7866
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=233887"

Return to bug 233187