View Javadoc
Minimize
Table

Bug Overview

linebug prioritybugbug descriptionexisting sinceauthor
84mediumUselessOverridingMethodDas Überladen dieser Methode ist überflüssig, da die Methode die Implementierung einer Superklasse aufruft.  Details zum Fehler...18.06.2012-10:31Unbekannt

1   /*
2    * Copyright 2003-2007 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.codehaus.groovy.ast.expr;
17  
18  import org.codehaus.groovy.ast.ClassNode;
19  import org.codehaus.groovy.ast.GroovyCodeVisitor;
20  
21  /**
22   * Represents a type cast expression
23   * 
24   * @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
25   * @version $Revision: 7922 $
26   */
27  public class CastExpression extends Expression {
28      
29      private final Expression expression;
30      private boolean ignoreAutoboxing=false;
31      private boolean coerce = false;
32  
33      public static CastExpression asExpression(ClassNode type, Expression expression) {
34          CastExpression answer = new CastExpression(type, expression);
35          answer.setCoerce(true);
36          return answer;
37      }
38  
39      public CastExpression(ClassNode type, Expression expression) {
40          this(type,expression,false);
41      }
42  
43      public CastExpression(ClassNode type, Expression expression, boolean ignoreAutoboxing) {
44          super.setType(type);
45          this.expression = expression;
46          this.ignoreAutoboxing = ignoreAutoboxing;
47      }
48      
49      public boolean isIgnoringAutoboxing(){
50          return ignoreAutoboxing;
51      }
52  
53      public boolean isCoerce() {
54          return coerce;
55      }
56  
57      public void setCoerce(boolean coerce) {
58          this.coerce = coerce;
59      }
60  
61      public String toString() {
62          return super.toString() +"[(" + getType().getName() + ") " + expression + "]";
63      }
64  
65      public void visit(GroovyCodeVisitor visitor) {
66          visitor.visitCastExpression(this);
67      }
68  
69      public Expression transformExpression(ExpressionTransformer transformer) {
70          CastExpression ret =  new CastExpression(getType(), transformer.transform(expression));
71          ret.setSourcePosition(this);
72          ret.setCoerce(this.isCoerce());
73          return ret;
74      }
75      
76      public String getText() {
77          return "(" + getType() + ") " + expression.getText();
78      }
79   
80      public Expression getExpression() {
81          return expression;
82      }
83      
84 bug overview        public void setType(ClassNode t) {  HEALTH4J >>  :  UselessOverridingMethod 
85          super.setType(t);
86      }
87  
88  }