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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (+5 lines)
Lines 342-347 Link Here
342
	public boolean generateClassFiles;
342
	public boolean generateClassFiles;
343
	/** Indicate if method bodies should be ignored */
343
	/** Indicate if method bodies should be ignored */
344
	public boolean ignoreMethodBodies;
344
	public boolean ignoreMethodBodies;
345
	/** Indicate if generics (type parameters and such) should be retained */
346
	public boolean shouldRetainGenerics; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633
345
347
346
	// keep in sync with warningTokenToIrritant and warningTokenFromIrritant
348
	// keep in sync with warningTokenToIrritant and warningTokenFromIrritant
347
	public final static String[] warningTokens = {
349
	public final static String[] warningTokens = {
Lines 1048-1053 Link Here
1048
		
1050
		
1049
		// ignore method bodies
1051
		// ignore method bodies
1050
		this.ignoreMethodBodies = false;
1052
		this.ignoreMethodBodies = false;
1053
		
1054
		// throw away generics
1055
		this.shouldRetainGenerics = false;
1051
	}
1056
	}
1052
1057
1053
	public void set(Map optionsMap) {
1058
	public void set(Map optionsMap) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-5 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 149-155 Link Here
149
	this.fPackage = packageBinding;
149
	this.fPackage = packageBinding;
150
	this.fileName = binaryType.getFileName();
150
	this.fileName = binaryType.getFileName();
151
151
152
	char[] typeSignature = environment.globalOptions.sourceLevel >= ClassFileConstants.JDK1_5 ? binaryType.getGenericSignature() : null;
152
	char[] typeSignature = (environment.globalOptions.sourceLevel >= ClassFileConstants.JDK1_5 || environment.globalOptions.shouldRetainGenerics) ? binaryType.getGenericSignature() : null;
153
	this.typeVariables = typeSignature != null && typeSignature.length > 0 && typeSignature[0] == '<'
153
	this.typeVariables = typeSignature != null && typeSignature.length > 0 && typeSignature[0] == '<'
154
		? null // is initialized in cachePartsFrom (called from LookupEnvironment.createBinaryTypeFrom())... must set to null so isGenericType() answers true
154
		? null // is initialized in cachePartsFrom (called from LookupEnvironment.createBinaryTypeFrom())... must set to null so isGenericType() answers true
155
		: Binding.NO_TYPE_VARIABLES;
155
		: Binding.NO_TYPE_VARIABLES;
Lines 262-268 Link Here
262
262
263
		long sourceLevel = this.environment.globalOptions.sourceLevel;
263
		long sourceLevel = this.environment.globalOptions.sourceLevel;
264
		char[] typeSignature = null;
264
		char[] typeSignature = null;
265
		if (sourceLevel >= ClassFileConstants.JDK1_5) {
265
		if (sourceLevel >= ClassFileConstants.JDK1_5 || this.environment.globalOptions.shouldRetainGenerics) {
266
			typeSignature = binaryType.getGenericSignature();
266
			typeSignature = binaryType.getGenericSignature();
267
			this.tagBits |= binaryType.getTagBits();
267
			this.tagBits |= binaryType.getTagBits();
268
		}
268
		}
Lines 360-366 Link Here
360
		int size = iFields.length;
360
		int size = iFields.length;
361
		if (size > 0) {
361
		if (size > 0) {
362
			this.fields = new FieldBinding[size];
362
			this.fields = new FieldBinding[size];
363
			boolean use15specifics = sourceLevel >= ClassFileConstants.JDK1_5;
363
			boolean use15specifics = sourceLevel >= ClassFileConstants.JDK1_5 || this.environment.globalOptions.shouldRetainGenerics;
364
			boolean hasRestrictedAccess = hasRestrictedAccess();
364
			boolean hasRestrictedAccess = hasRestrictedAccess();
365
			int firstAnnotatedFieldIndex = -1;
365
			int firstAnnotatedFieldIndex = -1;
366
			for (int i = 0; i < size; i++) {
366
			for (int i = 0; i < size; i++) {
Lines 411-417 Link Here
411
	AnnotationBinding[][] paramAnnotations = null;
411
	AnnotationBinding[][] paramAnnotations = null;
412
	TypeBinding returnType = null;
412
	TypeBinding returnType = null;
413
413
414
	final boolean use15specifics = sourceLevel >= ClassFileConstants.JDK1_5;
414
	final boolean use15specifics = sourceLevel >= ClassFileConstants.JDK1_5 || this.environment.globalOptions.shouldRetainGenerics;
415
	char[] methodSignature = use15specifics ? method.getGenericSignature() : null;
415
	char[] methodSignature = use15specifics ? method.getGenericSignature() : null;
416
	if (methodSignature == null) { // no generics
416
	if (methodSignature == null) { // no generics
417
		char[] methodDescriptor = method.getMethodDescriptor();   // of the form (I[Ljava/jang/String;)V
417
		char[] methodDescriptor = method.getMethodDescriptor();   // of the form (I[Ljava/jang/String;)V
(-)model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java (+1 lines)
Lines 177-182 Link Here
177
			CompilerOptions compilerOptions = getCompilerOptions(project.getOptions(true), creatingAST, ((reconcileFlags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0));
177
			CompilerOptions compilerOptions = getCompilerOptions(project.getOptions(true), creatingAST, ((reconcileFlags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0));
178
			boolean ignoreMethodBodies = (reconcileFlags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
178
			boolean ignoreMethodBodies = (reconcileFlags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
179
			compilerOptions.ignoreMethodBodies = ignoreMethodBodies;
179
			compilerOptions.ignoreMethodBodies = ignoreMethodBodies;
180
			compilerOptions.shouldRetainGenerics = project.mayNeedGenerifiedAPIs(); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633
180
			problemFinder = new CompilationUnitProblemFinder(
181
			problemFinder = new CompilationUnitProblemFinder(
181
				environment,
182
				environment,
182
				getHandlingPolicy(),
183
				getHandlingPolicy(),
(-)model/org/eclipse/jdt/internal/core/JavaProject.java (+22 lines)
Lines 66-71 Link Here
66
import org.eclipse.jdt.core.compiler.CategorizedProblem;
66
import org.eclipse.jdt.core.compiler.CategorizedProblem;
67
import org.eclipse.jdt.core.compiler.CharOperation;
67
import org.eclipse.jdt.core.compiler.CharOperation;
68
import org.eclipse.jdt.core.eval.IEvaluationContext;
68
import org.eclipse.jdt.core.eval.IEvaluationContext;
69
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
70
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
69
import org.eclipse.jdt.internal.compiler.util.ObjectVector;
71
import org.eclipse.jdt.internal.compiler.util.ObjectVector;
70
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
72
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
71
import org.eclipse.jdt.internal.core.JavaModelManager.PerProjectInfo;
73
import org.eclipse.jdt.internal.core.JavaModelManager.PerProjectInfo;
Lines 3167-3170 Link Here
3167
		}
3169
		}
3168
		return JavaModelStatus.VERIFIED_OK;
3170
		return JavaModelStatus.VERIFIED_OK;
3169
	}
3171
	}
3172
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633
3173
	public boolean mayNeedGenerifiedAPIs() {
3174
		long sourceLevel = CompilerOptions.versionToJdkLevel(getOption(JavaCore.COMPILER_SOURCE, true));
3175
		if (sourceLevel >= ClassFileConstants.JDK1_5) {
3176
			return true;
3177
		}
3178
		try {
3179
			String [] prerequisites = getRequiredProjectNames();
3180
			for (int i = 0, length = prerequisites.length; i < length; i++) {
3181
				IJavaProject that = getJavaModel().getJavaProject(prerequisites[i]);
3182
				if (that instanceof JavaProject) {
3183
					if (((JavaProject) that).mayNeedGenerifiedAPIs())
3184
						return true;
3185
				}
3186
			}
3187
		} catch (JavaModelException e) {
3188
			// ignore ...
3189
		}
3190
		return false;
3191
	}
3170
}
3192
}

Return to bug 323633