Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 418920 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/elementutils/ElementUtilsProc.java (-3 / +4 lines)
Lines 471-478 public class ElementUtilsProc extends BaseProcessor Link Here
471
				"\n" +
471
				"\n" +
472
				" Javadoc on _fieldT1_private\n" +
472
				" Javadoc on _fieldT1_private\n" +
473
				"  this line starts with two spaces, no asterisk\n" +
473
				"  this line starts with two spaces, no asterisk\n" +
474
				"        This line starts, contains\tand ends with a tab\t\n" +
474
				"	This line starts, contains\tand ends with a tab\t\n" +
475
				"                 This line starts with a space, tab, space, tab, space\n");
475
				" 	 	 This line starts with a space, tab, space, tab, space\n");
476
		nameToDoc.put("fieldInt", null);
476
		nameToDoc.put("fieldInt", null);
477
		nameToDoc.put("method_T1", " Javadoc on F.method_T1\n");
477
		nameToDoc.put("method_T1", " Javadoc on F.method_T1\n");
478
		nameToDoc.put("method_String", null);
478
		nameToDoc.put("method_String", null);
Lines 481-487 public class ElementUtilsProc extends BaseProcessor Link Here
481
		nameToDoc.put("foo", "\n Creates a new instance of AllChecks \n");
481
		nameToDoc.put("foo", "\n Creates a new instance of AllChecks \n");
482
		nameToDoc.put("bar", " @bar\t(int)\n");
482
		nameToDoc.put("bar", " @bar\t(int)\n");
483
		nameToDoc.put("bar2", "\t@bar2(int)\n");
483
		nameToDoc.put("bar2", "\t@bar2(int)\n");
484
		nameToDoc.put("m", "                Method\tm\n");
484
		nameToDoc.put("m", "		Method\tm\n");
485
		nameToDoc.put("m1", "This is a comment for the method m1,\n" + 
485
		nameToDoc.put("m1", "This is a comment for the method m1,\n" + 
486
				"  it is on two lines\n");
486
				"  it is on two lines\n");
487
		nameToDoc.put("m2", "Another comment - starts on first line and\n" + 
487
		nameToDoc.put("m2", "Another comment - starts on first line and\n" + 
Lines 510-515 public class ElementUtilsProc extends BaseProcessor Link Here
510
					return false;
510
					return false;
511
				}
511
				}
512
				else if (expected != null) {
512
				else if (expected != null) {
513
					//Comparison takes place here.
513
					if (!expected.equals(actual)) {
514
					if (!expected.equals(actual)) {
514
						reportError("examineGetDocComment: Unexpected result from getDocComment(" + name + "): " + _elementUtils.getDocComment(e));
515
						reportError("examineGetDocComment: Unexpected result from getDocComment(" + name + "): " + _elementUtils.getDocComment(e));
515
						return false;
516
						return false;
(-)a/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/typeutils/TypeUtilsProc.java (-10 / +10 lines)
Lines 273-297 public class TypeUtilsProc extends BaseProcessor Link Here
273
	private boolean examineGetDeclaredTypeNested() {
273
	private boolean examineGetDeclaredTypeNested() {
274
		TypeElement stringDecl = _elementUtils.getTypeElement(String.class.getName());
274
		TypeElement stringDecl = _elementUtils.getTypeElement(String.class.getName());
275
		TypeElement numberDecl = _elementUtils.getTypeElement(Number.class.getName());
275
		TypeElement numberDecl = _elementUtils.getTypeElement(Number.class.getName());
276
		TypeElement mapDecl = _elementUtils.getTypeElement("java.util.HashMap");
276
		TypeElement elementOuter = _elementUtils.getTypeElement("targets.model.pd.Outer");
277
		TypeElement iterDecl = _elementUtils.getTypeElement("java.util.HashMap.HashIterator");
277
		TypeElement elementInner = _elementUtils.getTypeElement("targets.model.pd.Outer.Inner");
278
		DeclaredType stringType = _typeUtils.getDeclaredType(stringDecl);
278
		DeclaredType stringType = _typeUtils.getDeclaredType(stringDecl);
279
		DeclaredType numberType = _typeUtils.getDeclaredType(numberDecl);
279
		DeclaredType numberType = _typeUtils.getDeclaredType(numberDecl);
280
		ArrayType numberArrayType = _typeUtils.getArrayType(numberType);
280
		ArrayType numberArrayType = _typeUtils.getArrayType(numberType);
281
281
282
		// HashMap<String, Number[]>
282
		// Outer<T1, T2> ---> Outer<String, Number[]>
283
		DeclaredType outerType = _typeUtils.getDeclaredType(mapDecl, stringType, numberArrayType);
283
		DeclaredType outerType = _typeUtils.getDeclaredType(elementOuter, stringType, numberArrayType);
284
		
284
285
		// HashMap<String, Number[]>.HashIterator<Number[]>
285
		// Outer<T1, T2>.Inner<T2> ---> Outer<String, Number[]>.Inner<Number[]>
286
		DeclaredType decl = _typeUtils.getDeclaredType(outerType, iterDecl, new TypeMirror[] { numberArrayType });
286
		DeclaredType decl = _typeUtils.getDeclaredType(outerType, elementInner, new TypeMirror[] { numberArrayType });
287
		
287
288
		List<? extends TypeMirror> args = decl.getTypeArguments();
288
		List<? extends TypeMirror> args = decl.getTypeArguments();
289
		if (args.size() != 1) {
289
		if (args.size() != 1) {
290
			reportError("Map<String, Number[]>.EntryIterator<Number[]> should have one argument but decl.getTypeArguments() returned " + args.size());
290
			reportError("Outer<String, Number[]>.Inner<Number[]> should have one argument but decl.getTypeArguments() returned " + args.size());
291
			return false;
291
			return false;
292
		}
292
		}
293
		if (!_typeUtils.isSameType(numberArrayType, args.get(0))) {
293
		if (!_typeUtils.isSameType(numberArrayType, args.get(0))) {
294
			reportError("First arg of Map<String, Number[]>.EntryIterator<Number[]> was expected to be Number[], but was: " + args.get(0));
294
			reportError("First arg of Outer<String, Number[]>.Inner<Number[]> was expected to be Number[], but was: " + args.get(0));
295
			return false;
295
			return false;
296
		}
296
		}
297
		return true;
297
		return true;
(-)a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pd/Outer.java (+12 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
package targets.model.pd;
9
10
class Outer<T1, T2> {
11
	class Inner<T3> {}
12
}
(-)a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ElementsImpl.java (-11 / +4 lines)
Lines 456-472 public class ElementsImpl implements Elements { Link Here
456
			for (int i = 0, max = chars.length; i < max; i++) {
456
			for (int i = 0, max = chars.length; i < max; i++) {
457
				char c = chars[i];
457
				char c = chars[i];
458
				switch(c) {
458
				switch(c) {
459
					case '\t' :
460
						if (starsIndex == -1) {
461
							if (recordLeadingWhitespaces) {
462
								leadingWhitespaces += 8;
463
							} else {
464
								sb.append(c);
465
							}
466
						} else if (i >= starsIndex) {
467
							sb.append(c);
468
						}
469
						break;
470
					case ' ' :
459
					case ' ' :
471
						if (starsIndex == -1) {
460
						if (starsIndex == -1) {
472
							if (recordLeadingWhitespaces) {
461
							if (recordLeadingWhitespaces) {
Lines 498-503 public class ElementsImpl implements Elements { Link Here
498
							}
487
							}
499
							leadingWhitespaces = 0;
488
							leadingWhitespaces = 0;
500
							sb.append(c);
489
							sb.append(c);
490
						} else if (c == '\t') {
491
							if (i >= starsIndex) {
492
								sb.append(c);
493
							}
501
						} else if (c != '*' || i > starsIndex) {
494
						} else if (c != '*' || i > starsIndex) {
502
							sb.append(c);
495
							sb.append(c);
503
						}
496
						}
(-)a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava8Tests.java (-2 / +1 lines)
Lines 23-29 import junit.framework.Test; Link Here
23
import junit.framework.TestCase;
23
import junit.framework.TestCase;
24
import junit.framework.TestSuite;
24
import junit.framework.TestSuite;
25
25
26
import org.eclipse.jdt.compiler.apt.tests.Java8ElementsTests;
27
import org.eclipse.jdt.core.tests.compiler.parser.ComplianceDiagnoseTest;
26
import org.eclipse.jdt.core.tests.compiler.parser.ComplianceDiagnoseTest;
28
import org.eclipse.jdt.core.tests.dom.ASTConverter15JLS8Test;
27
import org.eclipse.jdt.core.tests.dom.ASTConverter15JLS8Test;
29
import org.eclipse.jdt.core.tests.dom.ASTConverter18Test;
28
import org.eclipse.jdt.core.tests.dom.ASTConverter18Test;
Lines 63-69 public class RunAllJava8Tests extends TestCase { Link Here
63
				ASTConverter18Test.class,
62
				ASTConverter18Test.class,
64
				ASTRewritingTest.class,
63
				ASTRewritingTest.class,
65
				TypeBindingTests308.class,
64
				TypeBindingTests308.class,
66
				Java8ElementsTests.class,
65
				org.eclipse.jdt.compiler.apt.tests.AllTests.class,
67
		};
66
		};
68
	}
67
	}
69
68

Return to bug 418920