Index: src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java
===================================================================
--- src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java	(revision 675)
+++ src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java	(revision 687)
@@ -632,7 +632,7 @@
         Expression initialValue = null;
         if (node != null) {
             assertNodeType(ASSIGN, node);
-            initialValue = expression(node);
+            initialValue = expression(node.getFirstChild());
         }
 
         if (classNode.isInterface() && initialValue == null && type != null) {
@@ -1089,11 +1089,11 @@
         }
 
         String name = identifier(node);
+        VariableExpression leftExpression = new VariableExpression(name, type);
+        configureAST(leftExpression, node);
+        
         node = node.getNextSibling();
 
-        VariableExpression leftExpression = new VariableExpression(name, type);
-        configureAST(leftExpression, variableDef);
-
         Expression rightExpression = ConstantExpression.NULL;
         if (node != null) {
             assertNodeType(ASSIGN, node);

Index: src/main/org/codehaus/groovy/ast/Parameter.java
===================================================================
--- src/main/org/codehaus/groovy/ast/Parameter.java	(revision 675)
+++ src/main/org/codehaus/groovy/ast/Parameter.java	(revision 687)
@@ -103,4 +103,8 @@
     public void setClosureSharedVariable(boolean inClosure) {
         closureShare = inClosure;        
     }
+
+	public ClassNode getOriginType() {
+		return getType();
+	}
 }
Index: src/main/org/codehaus/groovy/ast/AnnotatedNode.java
===================================================================
--- src/main/org/codehaus/groovy/ast/AnnotatedNode.java	(revision 675)
+++ src/main/org/codehaus/groovy/ast/AnnotatedNode.java	(revision 687)
@@ -70,9 +70,9 @@
 
     private void checkInit() {
         if (annotations == Collections.EMPTY_MAP)
-          annotations = new HashMap();
+        	annotations = new LinkedHashMap();
         if (annotationClasses == Collections.EMPTY_MAP)
-          annotationClasses = new HashMap();
+        	annotationClasses = new LinkedHashMap();
     }
 
     public void addAnnotations(List annotations) {
Index: src/main/org/codehaus/groovy/ast/Variable.java
===================================================================
--- src/main/org/codehaus/groovy/ast/Variable.java	(revision 675)
+++ src/main/org/codehaus/groovy/ast/Variable.java	(revision 687)
@@ -31,6 +31,11 @@
     ClassNode getType();
     
     /**
+     * the type before wrapping primitives type of the variable
+     */
+    ClassNode getOriginType();
+    
+    /**
      * the name of the variable
      */
     String getName();
Index: src/main/org/codehaus/groovy/ast/MethodNode.java
===================================================================
--- src/main/org/codehaus/groovy/ast/MethodNode.java	(revision 675)
+++ src/main/org/codehaus/groovy/ast/MethodNode.java	(revision 687)
@@ -46,8 +46,7 @@
         this.name = name;
         this.modifiers = modifiers;
         this.code = code;
-        this.returnType = returnType;
-        if (returnType==null) this.returnType = ClassHelper.OBJECT_TYPE; 
+        setReturnType(returnType); 
         VariableScope scope = new VariableScope();
         setVariableScope(scope);
         setParameters(parameters);
@@ -167,7 +166,9 @@
     }
 
     public void setReturnType(ClassNode returnType) {
+    	dynamicReturnType |= ClassHelper.DYNAMIC_TYPE==returnType;
         this.returnType = returnType;
+        if (returnType==null) this.returnType = ClassHelper.OBJECT_TYPE;
     }
 
     public ClassNode[] getExceptions() {
Index: src/main/org/codehaus/groovy/ast/FieldNode.java
===================================================================
--- src/main/org/codehaus/groovy/ast/FieldNode.java	(revision 675)
+++ src/main/org/codehaus/groovy/ast/FieldNode.java	(revision 687)
@@ -128,4 +128,8 @@
     public void setClosureSharedVariable(boolean inClosure) {
         closureShare = inClosure;        
     }
+
+	public ClassNode getOriginType() {
+		return getType();
+	}
 }
Index: src/main/org/codehaus/groovy/ast/DynamicVariable.java
===================================================================
--- src/main/org/codehaus/groovy/ast/DynamicVariable.java	(revision 675)
+++ src/main/org/codehaus/groovy/ast/DynamicVariable.java	(revision 687)
@@ -60,4 +60,8 @@
         closureShare = inClosure;        
     }
 
+	public ClassNode getOriginType() {
+		return getType();
+	}
+
 }
Index: src/main/org/codehaus/groovy/ast/PropertyNode.java
===================================================================
--- src/main/org/codehaus/groovy/ast/PropertyNode.java	(revision 675)
+++ src/main/org/codehaus/groovy/ast/PropertyNode.java	(revision 687)
@@ -107,4 +107,8 @@
     public void setClosureSharedVariable(boolean inClosure) {
         closureShare = inClosure;        
     }
+
+	public ClassNode getOriginType() {
+		return getType();
+	}
 }
Index: src/main/org/codehaus/groovy/ast/expr/VariableExpression.java
===================================================================
--- src/main/org/codehaus/groovy/ast/expr/VariableExpression.java	(revision 675)
+++ src/main/org/codehaus/groovy/ast/expr/VariableExpression.java	(revision 687)
@@ -36,6 +36,7 @@
     private boolean isDynamicTyped=false;
     private Variable accessedVariable;
     boolean closureShare=false;
+    private ClassNode originType;
 
     public Variable getAccessedVariable() {
         return accessedVariable;
@@ -47,6 +48,7 @@
 
     public VariableExpression(String variable, ClassNode type) {
         this.variable = variable;
+        originType = type;
         setType(ClassHelper.getWrapper(type));
     }
     
@@ -55,7 +57,7 @@
     }
     
     public VariableExpression(Variable variable) {
-        this(variable.getName(), variable.getType());
+        this(variable.getName(), variable.getOriginType());
         setAccessedVariable(variable);
     }
 
@@ -121,4 +123,8 @@
         if (accessedVariable!=null && accessedVariable!=this) return accessedVariable.getType();
         return super.getType();
     }
+    
+    public ClassNode getOriginType() {
+    	return originType;
+    }
 }



