-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bugs on local variable declaration
- Loading branch information
emmanue1
committed
Jul 29, 2019
1 parent
5ae9e8a
commit 87ecfad
Showing
14 changed files
with
245 additions
and
55 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
...onverter/classfiletojavasyntax/model/javasyntax/declaration/ClassFileFormalParameter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (c) 2008-2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.core.v1.service.converter.classfiletojavasyntax.model.javasyntax.declaration; | ||
|
||
import org.jd.core.v1.model.javasyntax.declaration.FormalParameter; | ||
import org.jd.core.v1.model.javasyntax.reference.BaseAnnotationReference; | ||
import org.jd.core.v1.model.javasyntax.type.Type; | ||
import org.jd.core.v1.service.converter.classfiletojavasyntax.model.localvariable.AbstractLocalVariable; | ||
import org.jd.core.v1.service.converter.classfiletojavasyntax.model.localvariable.LocalVariableReference; | ||
|
||
|
||
public class ClassFileFormalParameter extends FormalParameter implements LocalVariableReference { | ||
protected AbstractLocalVariable localVariable; | ||
|
||
public ClassFileFormalParameter(AbstractLocalVariable localVariable) { | ||
super(null, null); | ||
this.localVariable = localVariable; | ||
} | ||
|
||
public ClassFileFormalParameter(AbstractLocalVariable localVariable, boolean varargs) { | ||
super(null, varargs, null); | ||
this.localVariable = localVariable; | ||
} | ||
|
||
public ClassFileFormalParameter(BaseAnnotationReference annotationReferences, AbstractLocalVariable localVariable, boolean varargs) { | ||
super(annotationReferences, null, varargs, null); | ||
this.localVariable = localVariable; | ||
} | ||
|
||
public Type getType() { | ||
return localVariable.getType(); | ||
} | ||
|
||
public String getName() { | ||
return localVariable.getName(); | ||
} | ||
|
||
public void setName(String name) { | ||
localVariable.setName(name); | ||
} | ||
|
||
@Override | ||
public AbstractLocalVariable getLocalVariable() { | ||
return localVariable; | ||
} | ||
|
||
@Override | ||
public void setLocalVariable(AbstractLocalVariable localVariable) { | ||
this.localVariable = localVariable; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String s = "ClassFileFormalParameter{"; | ||
|
||
if (annotationReferences != null) | ||
s += annotationReferences + " "; | ||
|
||
Type type = localVariable.getType(); | ||
|
||
if (varargs) | ||
s += type.createType(type.getDimension()-1) + "... "; | ||
else | ||
s += type + " "; | ||
|
||
return s + localVariable.getName() + "}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...1/service/converter/classfiletojavasyntax/model/localvariable/LocalVariableReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright (c) 2008, 2019 Emmanuel Dupuy. | ||
* This project is distributed under the GPLv3 license. | ||
* This is a Copyleft license that gives the user the right to use, | ||
* copy and modify the code freely for non-commercial purposes. | ||
*/ | ||
|
||
package org.jd.core.v1.service.converter.classfiletojavasyntax.model.localvariable; | ||
|
||
|
||
public interface LocalVariableReference { | ||
AbstractLocalVariable getLocalVariable(); | ||
|
||
void setLocalVariable(AbstractLocalVariable localVariable); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.