]> git.uio.no Git - ifi-stolz-refaktor.git/blame - case-study/jdt-after/core refactoring/org/eclipse/jdt/internal/corext/refactoring/ReturnTypeInfo.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-after / core refactoring / org / eclipse / jdt / internal / corext / refactoring / ReturnTypeInfo.java
CommitLineData
1b2798f6
EK
1/*******************************************************************************
2 * Copyright (c) 2000, 2011 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 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.eclipse.jdt.internal.corext.refactoring;
12
13import org.eclipse.core.runtime.Assert;
14import org.eclipse.core.runtime.CoreException;
15
16import org.eclipse.ltk.core.refactoring.RefactoringStatus;
17
18import org.eclipse.jdt.core.dom.ITypeBinding;
19
20import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor;
21
22
23public class ReturnTypeInfo {
24
25 private final String fOldTypeName;
26 private String fNewTypeName;
27 private ITypeBinding fNewTypeBinding;
28
29 public ReturnTypeInfo(String returnType) {
30 fOldTypeName= returnType;
31 fNewTypeName= returnType;
32 }
33
34 public String getOldTypeName() {
35 return fOldTypeName;
36 }
37
38 public String getNewTypeName() {
39 return fNewTypeName;
40 }
41
42 public void setNewTypeName(String type){
43 Assert.isNotNull(type);
44 fNewTypeName= type;
45 }
46
47 public ITypeBinding getNewTypeBinding() {
48 return fNewTypeBinding;
49 }
50
51 public void setNewTypeBinding(ITypeBinding typeBinding){
52 fNewTypeBinding= typeBinding;
53 }
54
55 public boolean isTypeNameChanged() {
56 return !fOldTypeName.equals(fNewTypeName);
57 }
58
59 @Override
60 public String toString() {
61 return fOldTypeName + " -> " + fNewTypeName; //$NON-NLS-1$
62 }
63
64 public RefactoringStatus generated_4290602752965600854(ChangeSignatureProcessor changesignatureprocessor, boolean resolveBindings, RefactoringStatus result) {
65 try {
66 RefactoringStatus[] typeStati;
67 if (resolveBindings)
68 typeStati= TypeContextChecker.checkAndResolveMethodTypes(changesignatureprocessor.fMethod, changesignatureprocessor.getStubTypeContext(), changesignatureprocessor.getNotDeletedInfos(), this);
69 else
70 typeStati= TypeContextChecker.checkMethodTypesSyntax(changesignatureprocessor.fMethod, changesignatureprocessor.getNotDeletedInfos(), this);
71 for (int i= 0; i < typeStati.length; i++)
72 result.merge(typeStati[i]);
73
74 result.merge(changesignatureprocessor.checkVarargs());
75 } catch (CoreException e) {
76 //cannot do anything here
77 throw new RuntimeException(e);
78 }
79
80 //checkExceptions() unnecessary (IType always ok)
81 return result;
82 }
83}