diff options
author | Tobias Widmer | 2005-02-25 11:09:31 +0000 |
---|---|---|
committer | Tobias Widmer | 2005-02-25 11:09:31 +0000 |
commit | 4b23010e5bbc3d5db9681c178af671a891c4177a (patch) | |
tree | 577cf9499a47984193cdf92dbf6c6b16a5ad6f54 | |
parent | bb4a9e1630f1cb7e82b1b3e1ef7834f7e820ccc6 (diff) | |
download | eclipse.jdt.ui-4b23010e5bbc3d5db9681c178af671a891c4177a.tar.gz eclipse.jdt.ui-4b23010e5bbc3d5db9681c178af671a891c4177a.tar.xz eclipse.jdt.ui-4b23010e5bbc3d5db9681c178af671a891c4177a.zip |
Added support for covariant return types
-rw-r--r-- | org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/constraints/SuperTypeRefactoringProcessor.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/constraints/SuperTypeRefactoringProcessor.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/constraints/SuperTypeRefactoringProcessor.java index a1570198ac..9cadc392cc 100644 --- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/constraints/SuperTypeRefactoringProcessor.java +++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/constraints/SuperTypeRefactoringProcessor.java @@ -33,6 +33,7 @@ import org.eclipse.jdt.core.IField; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.WorkingCopyOwner; import org.eclipse.jdt.core.dom.AST; @@ -569,7 +570,9 @@ public abstract class SuperTypeRefactoringProcessor extends RefactoringProcessor * @throws JavaModelException if an error occurs */ protected final void solveSuperTypeConstraints(final ICompilationUnit subUnit, final CompilationUnit subNode, final IType type, final ITypeBinding subType, final ITypeBinding superType, final IProgressMonitor monitor, final RefactoringStatus status) throws JavaModelException { + boolean covariance= true; final SuperTypeConstraintsModel model= new SuperTypeConstraintsModel(subType, superType); + model.setUseCovariance(true); final SuperTypeConstraintsCreator creator= new SuperTypeConstraintsCreator(model); fSuperType= model.getSuperType(); try { @@ -584,6 +587,10 @@ public abstract class SuperTypeRefactoringProcessor extends RefactoringProcessor final Map groups= new HashMap(); for (final Iterator outer= firstPass.keySet().iterator(); outer.hasNext();) { project= (IJavaProject) outer.next(); + if (covariance && !JavaCore.VERSION_1_5.equals(project.getOption(JavaCore.COMPILER_COMPLIANCE, true))) { + covariance= false; + model.setUseCovariance(false); + } collection= (Collection) firstPass.get(project); if (collection != null) { for (final Iterator inner= collection.iterator(); inner.hasNext();) { @@ -618,6 +625,10 @@ public abstract class SuperTypeRefactoringProcessor extends RefactoringProcessor performFirstPass(creator, secondPass, groups, subUnit, subNode); for (final Iterator iterator= secondPass.keySet().iterator(); iterator.hasNext();) { project= (IJavaProject) iterator.next(); + if (covariance && !JavaCore.VERSION_1_5.equals(project.getOption(JavaCore.COMPILER_COMPLIANCE, true))) { + covariance= false; + model.setUseCovariance(false); + } collection= (Collection) secondPass.get(project); if (collection != null && !collection.isEmpty()) { parser.setWorkingCopyOwner(fOwner); |