Compare commits
2 commits
bd2cf6c26a
...
77f075abdc
Author | SHA1 | Date | |
---|---|---|---|
|
77f075abdc | ||
|
86e326db87 |
11 changed files with 517 additions and 349 deletions
|
@ -8,21 +8,18 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import be.jeffcheasey88.peeratcode.parser.java.Variable.MultipleDeclaratedVariable;
|
import be.jeffcheasey88.peeratcode.parser.java.Variable.MultipleDeclaratedVariable;
|
||||||
|
|
||||||
public class Class{
|
public class Class extends JavaElement{
|
||||||
|
|
||||||
private static Pattern PATTERN = Pattern.compile("^(\\s*([^\\{]*)\\{(.*)\\})\\s*$");
|
private static Pattern PATTERN = Pattern.compile("^(\\s*([^\\{]*)\\{(.*)\\})\\s*$");
|
||||||
|
|
||||||
private int modifier;
|
private int modifier;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private List<Variable> vars;
|
private List<JavaElement> childs;
|
||||||
private List<Function> functions;
|
|
||||||
|
|
||||||
public Class(){}
|
public Class(){}
|
||||||
|
|
||||||
public int parse(String content, CleanerPool cleaner) throws Exception{
|
public int parse(String content, CleanerPool cleaner) throws Exception{
|
||||||
content = cleaner.clean(content);
|
|
||||||
|
|
||||||
Matcher matcher = PATTERN.matcher(content);
|
Matcher matcher = PATTERN.matcher(content);
|
||||||
matcher.matches();
|
matcher.matches();
|
||||||
|
|
||||||
|
@ -32,8 +29,7 @@ public class Class{
|
||||||
}
|
}
|
||||||
this.name = split[split.length-1];
|
this.name = split[split.length-1];
|
||||||
|
|
||||||
this.vars = new ArrayList<>();
|
this.childs = new ArrayList<>();
|
||||||
this.functions = new ArrayList<>();
|
|
||||||
|
|
||||||
content = matcher.group(3);
|
content = matcher.group(3);
|
||||||
Pattern empty = Pattern.compile("^\\s*$");
|
Pattern empty = Pattern.compile("^\\s*$");
|
||||||
|
@ -61,9 +57,9 @@ public class Class{
|
||||||
multiple.addVariable(variable.getName(), variable.getValue());
|
multiple.addVariable(variable.getName(), variable.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.vars.add(multiple);
|
this.childs.add(multiple);
|
||||||
}else{
|
}else{
|
||||||
this.vars.add(variable);
|
this.childs.add(variable);
|
||||||
}
|
}
|
||||||
|
|
||||||
content = content.substring(1);
|
content = content.substring(1);
|
||||||
|
@ -71,13 +67,14 @@ public class Class{
|
||||||
// System.out.println("Function "+content);
|
// System.out.println("Function "+content);
|
||||||
Function func = new Function();
|
Function func = new Function();
|
||||||
int index = func.parse(content, cleaner);
|
int index = func.parse(content, cleaner);
|
||||||
this.functions.add(func);
|
this.childs.add(func);
|
||||||
content = content.substring(index);
|
content = content.substring(index);
|
||||||
// System.out.println("End "+content);
|
// System.out.println("End "+content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cleaner.unzip(matcher.group(1), ((s,p) -> s)).length();
|
// return cleaner.unzip(matcher.group(1), ((s,p) -> s)).length();
|
||||||
|
return matcher.group(1).length();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int indexOf(String value, String target){
|
private int indexOf(String value, String target){
|
||||||
|
@ -92,15 +89,18 @@ public class Class{
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Variable> getVariables(){
|
// public List<Variable> getVariables(){
|
||||||
return this.vars;
|
// return this.vars;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void show(){
|
public void show(int tab){
|
||||||
System.out.println(Modifier.toString(modifier)+" "+this.name+"{");
|
String start = "";
|
||||||
for(Variable v : this.vars) v.show(1);
|
for(int i = 0; i < tab; i++) start+="\t";
|
||||||
|
System.out.println(start+Modifier.toString(modifier)+" "+this.name+"{");
|
||||||
|
for(JavaElement jElement : this.childs){
|
||||||
|
jElement.show(tab+1);
|
||||||
System.out.println();
|
System.out.println();
|
||||||
for(Function f : this.functions) f.show(1);
|
}
|
||||||
System.out.println("}");
|
System.out.println(start+"}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,12 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
||||||
|
import be.jeffcheasey88.peeratcode.parser.java.Variable.MultipleDeclaratedVariable;
|
||||||
|
import be.jeffcheasey88.peeratcode.parser.java.operations.OperationFactory;
|
||||||
|
|
||||||
public class Function {
|
public class Function extends JavaElement{
|
||||||
|
|
||||||
|
private static OperationFactory FACTORY = new OperationFactory();
|
||||||
|
|
||||||
private static Pattern PATTERN = Pattern.compile("^(\\s*([^(]*)\\(([^)]*)\\)\\s*([^{]*)\\{)(.*)$");
|
private static Pattern PATTERN = Pattern.compile("^(\\s*([^(]*)\\(([^)]*)\\)\\s*([^{]*)\\{)(.*)$");
|
||||||
|
|
||||||
|
@ -19,13 +23,11 @@ public class Function {
|
||||||
private List<Variable> parameters;
|
private List<Variable> parameters;
|
||||||
private String exceptions;
|
private String exceptions;
|
||||||
|
|
||||||
private List<Variable> variables;
|
private List<JavaElement> childs;
|
||||||
private List<Operation> operations;
|
|
||||||
|
|
||||||
public Function(){
|
public Function(){
|
||||||
this.parameters = new ArrayList<>();
|
this.parameters = new ArrayList<>();
|
||||||
this.variables = new ArrayList<>();
|
this.childs = new ArrayList<>();
|
||||||
this.operations = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int parse(String content, CleanerPool cleaner) throws Exception{
|
public int parse(String content, CleanerPool cleaner) throws Exception{
|
||||||
|
@ -90,8 +92,40 @@ public class Function {
|
||||||
}while(quote);
|
}while(quote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void body(String content, CleanerPool cleaner) throws Exception{
|
private void body(String content, CleanerPool cleaner) throws Exception{
|
||||||
|
while(!(content.replaceAll("\\s+", "").isEmpty())){
|
||||||
System.out.println("BODY "+content);
|
System.out.println("BODY "+content);
|
||||||
|
|
||||||
|
JavaElement operation = FACTORY.buildOperation(content);
|
||||||
|
|
||||||
|
System.out.println("got "+operation.getClass().getSimpleName());
|
||||||
|
int index = operation.parse(content, cleaner);
|
||||||
|
content = content.substring(index);
|
||||||
|
if(operation instanceof Variable){
|
||||||
|
if(content.startsWith(",")){
|
||||||
|
Variable variable = (Variable)operation;
|
||||||
|
MultipleDeclaratedVariable multiple = new MultipleDeclaratedVariable(variable.getModifier(), variable.getType());
|
||||||
|
multiple.addVariable(variable.getName(), variable.getValue());
|
||||||
|
|
||||||
|
operation = multiple;
|
||||||
|
|
||||||
|
boolean quote;
|
||||||
|
do{
|
||||||
|
variable = new Variable(variable.getModifier(), variable.getType());
|
||||||
|
index = variable.parse(content, cleaner);
|
||||||
|
multiple.addVariable(variable.getName(), variable.getValue());
|
||||||
|
content = content.substring(index);
|
||||||
|
quote = content.startsWith(",");
|
||||||
|
content = content.substring(1);
|
||||||
|
}while(quote);
|
||||||
|
}else content = content.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.childs.add(operation);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(int tab){
|
public void show(int tab){
|
||||||
|
@ -101,6 +135,7 @@ public class Function {
|
||||||
for(Variable v : this.parameters) param+=","+v.getType()+" "+v.getName()+"";
|
for(Variable v : this.parameters) param+=","+v.getType()+" "+v.getName()+"";
|
||||||
if(!param.isEmpty()) param = param.substring(1);
|
if(!param.isEmpty()) param = param.substring(1);
|
||||||
System.out.println(start+Modifier.toString(modifier)+" "+returnType+" "+name+"("+param+") "+exceptions+"{");
|
System.out.println(start+Modifier.toString(modifier)+" "+returnType+" "+name+"("+param+") "+exceptions+"{");
|
||||||
|
for(JavaElement child : this.childs) child.show(tab+1);
|
||||||
System.out.println(start+"}");
|
System.out.println(start+"}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class Import {
|
||||||
return matcher.group(1).length();
|
return matcher.group(1).length();
|
||||||
}
|
}
|
||||||
|
|
||||||
// public int DoYouSeeMe(){ return false; }
|
// public int doYouSeeMe(){ return false; }
|
||||||
|
|
||||||
public String getName(){
|
public String getName(){
|
||||||
return this.name;
|
return this.name;
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package be.jeffcheasey88.peeratcode.parser.java;
|
||||||
|
|
||||||
|
public abstract class JavaElement {
|
||||||
|
|
||||||
|
public abstract int parse(String content, CleanerPool cleaner) throws Exception;
|
||||||
|
|
||||||
|
//Only for development
|
||||||
|
public abstract void show(int tab);
|
||||||
|
}
|
|
@ -7,7 +7,6 @@ import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
||||||
|
@ -58,9 +57,9 @@ public class JavaParser{
|
||||||
|
|
||||||
Class clazz = parser.getClazz();
|
Class clazz = parser.getClazz();
|
||||||
System.out.println(clazz.getName());
|
System.out.println(clazz.getName());
|
||||||
for(Variable variable : clazz.getVariables()){
|
// for(Variable variable : clazz.getVariables()){
|
||||||
variable.show(1);
|
// variable.show(1);
|
||||||
}
|
// }
|
||||||
}catch(Exception e) {}
|
}catch(Exception e) {}
|
||||||
}else{
|
}else{
|
||||||
for(File file : dir.listFiles()) show(file);
|
for(File file : dir.listFiles()) show(file);
|
||||||
|
@ -87,13 +86,12 @@ public class JavaParser{
|
||||||
|
|
||||||
String line;
|
String line;
|
||||||
while((line = reader.readLine()) != null){
|
while((line = reader.readLine()) != null){
|
||||||
|
line = cleaner.clean(line);
|
||||||
index = line.indexOf("//");
|
index = line.indexOf("//");
|
||||||
if(index >= 0) line = line.substring(0, index);
|
if(index >= 0) line = line.substring(0, index);
|
||||||
content+=line;
|
content+=line;
|
||||||
}
|
}
|
||||||
|
|
||||||
// content = CleanerPool.getterToDelete.clean(content);
|
|
||||||
|
|
||||||
this.pack = new Package();
|
this.pack = new Package();
|
||||||
index = this.pack.parse(content);
|
index = this.pack.parse(content);
|
||||||
content = content.substring(index);
|
content = content.substring(index);
|
||||||
|
@ -128,7 +126,7 @@ public class JavaParser{
|
||||||
System.out.println();
|
System.out.println();
|
||||||
for(Import i : this.imports) System.out.println("import "+i.getName()+";");
|
for(Import i : this.imports) System.out.println("import "+i.getName()+";");
|
||||||
System.out.println();
|
System.out.println();
|
||||||
this.clazz.show();
|
this.clazz.show(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getModifier(String modifier){
|
public static int getModifier(String modifier){
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
package be.jeffcheasey88.peeratcode.parser.java;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class Operation {
|
|
||||||
|
|
||||||
private static Pattern VARIABLE_PATTERN = Pattern.compile("^(\\s*([^;]*)).*$");
|
|
||||||
|
|
||||||
private String tmp;
|
|
||||||
|
|
||||||
public Operation(){}
|
|
||||||
|
|
||||||
public int parse(String content) throws Exception{
|
|
||||||
Matcher matcher = VARIABLE_PATTERN.matcher(content);
|
|
||||||
if(matcher.matches()){
|
|
||||||
this.tmp = matcher.group(2);
|
|
||||||
return matcher.group(1).length()+1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void show(int tab){
|
|
||||||
String start = "";
|
|
||||||
for(int i = 0; i < tab; i++) start+="\t";
|
|
||||||
System.out.println(start+tmp+";");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -9,14 +9,14 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
||||||
|
|
||||||
public class Variable {
|
public class Variable extends JavaElement{
|
||||||
|
|
||||||
private static Pattern PATTERN = Pattern.compile("^(\\s*)(.*)$");
|
private static Pattern PATTERN = Pattern.compile("^(\\s*)(.*)$");
|
||||||
|
|
||||||
private int modifier;
|
private int modifier;
|
||||||
private String name;
|
private String name;
|
||||||
private String type;
|
private String type;
|
||||||
private Variable value;
|
private Variable value; //Change into operation
|
||||||
|
|
||||||
public Variable(){}
|
public Variable(){}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package be.jeffcheasey88.peeratcode.parser.java.operations;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool;
|
||||||
|
import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
||||||
|
|
||||||
|
public class MethodCallOperation extends JavaElement{
|
||||||
|
|
||||||
|
private static Pattern PATTERN = Pattern.compile("^(\\s*([^\\(]*\\([^\\)]*\\));).*$");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public MethodCallOperation(){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int parse(String content, CleanerPool cleaner) throws Exception{
|
||||||
|
Matcher matcher = PATTERN.matcher(content);
|
||||||
|
matcher.matches();
|
||||||
|
|
||||||
|
this.value = matcher.group(2);
|
||||||
|
|
||||||
|
return matcher.group(1).length();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show(int tab){
|
||||||
|
String start = "";
|
||||||
|
for(int i = 0; i < tab; i++) start+="\t";
|
||||||
|
System.out.println(start+value+";");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package be.jeffcheasey88.peeratcode.parser.java.operations;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool;
|
||||||
|
import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
||||||
|
import be.jeffcheasey88.peeratcode.parser.java.Variable;
|
||||||
|
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
||||||
|
|
||||||
|
public class OperationFactory{
|
||||||
|
|
||||||
|
private Map<Pattern, Class<? extends JavaElement>> patterns;
|
||||||
|
|
||||||
|
public OperationFactory(){
|
||||||
|
this.patterns = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
this.patterns.put(Pattern.compile("^\\s*return\\s+[^;]*;.*$"), ReturnOperation.class);
|
||||||
|
this.patterns.put(Pattern.compile("^\\s*([^;=]*;).*$"), MethodCallOperation.class);
|
||||||
|
|
||||||
|
//if not types ??
|
||||||
|
this.patterns.put(Pattern.compile("^\\s*[^\\s]*\\s+[^\\s]*\\s+=\\s+[^\\s]*;.*$"), Variable.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* variable
|
||||||
|
* assignation
|
||||||
|
* exec method
|
||||||
|
* for
|
||||||
|
* do while
|
||||||
|
* while
|
||||||
|
* if
|
||||||
|
* switch case
|
||||||
|
* return
|
||||||
|
* continue
|
||||||
|
* break
|
||||||
|
* try catch finally
|
||||||
|
* throw
|
||||||
|
* else
|
||||||
|
* synchronized
|
||||||
|
* instance of
|
||||||
|
*
|
||||||
|
* native operation style i++
|
||||||
|
*
|
||||||
|
* assert ??
|
||||||
|
* Goto ??
|
||||||
|
*/
|
||||||
|
|
||||||
|
public JavaElement buildOperation(String content) throws Exception{
|
||||||
|
CleanerPool generic = new CleanerPool(
|
||||||
|
new Cleaner("GENERIC_TYPE_",'<','>'),
|
||||||
|
new Cleaner("GENERIC_ARRAY",'[',']'),
|
||||||
|
new Cleaner("GENERIC_FUNCTION", '{','}'),
|
||||||
|
new Cleaner("GENERIC_PARENTHESIS",'(',')'));
|
||||||
|
content = generic.clean(content);
|
||||||
|
generiqueTypes(content, generic);
|
||||||
|
|
||||||
|
for(Entry<Pattern, Class<? extends JavaElement>> entries : this.patterns.entrySet()){
|
||||||
|
if(entries.getKey().matcher(content).matches()) return entries.getValue().newInstance();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static Pattern UNZIP_STICK = Pattern.compile("\\s+(?<e>[<|(|\\[|\"|'])");
|
||||||
|
private static Pattern UNZIP_MAJ = Pattern.compile(">(?<e>[^>\\d,;(])");
|
||||||
|
private static Pattern UNZIP_ARRAY = Pattern.compile("](?<e>[^\\[\\d,;])");
|
||||||
|
private static Pattern UNZIP_EQUALS_LEFT = Pattern.compile("(?<e>[^=\\s])=");
|
||||||
|
private static Pattern UNZIP_EQUALS_RIGHT = Pattern.compile("=(?<e>[^=\\s])");
|
||||||
|
|
||||||
|
private String generiqueTypes(String content, CleanerPool cleaner){
|
||||||
|
String unzip = cleaner.unzip(content, (value, pattern) -> {
|
||||||
|
if(pattern.equals("^GENERIC_FUNCTION")) return null;
|
||||||
|
if(pattern.equals("^GENERIC_PARENTHESIS")) return value.replace("\\s+", " ");
|
||||||
|
return value.replaceAll("\\s+", "");
|
||||||
|
});
|
||||||
|
unzip = UNZIP_STICK.matcher(unzip).replaceAll("${e}");
|
||||||
|
unzip = UNZIP_MAJ.matcher(unzip).replaceAll("> ${e}");
|
||||||
|
unzip = UNZIP_ARRAY.matcher(unzip).replaceAll("] ${e}");
|
||||||
|
unzip = UNZIP_EQUALS_LEFT.matcher(unzip).replaceAll("${e} =");
|
||||||
|
unzip = UNZIP_EQUALS_RIGHT.matcher(unzip).replaceAll("= ${e}");
|
||||||
|
return unzip;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package be.jeffcheasey88.peeratcode.parser.java.operations;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool;
|
||||||
|
import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
||||||
|
|
||||||
|
public class ReturnOperation extends JavaElement{
|
||||||
|
|
||||||
|
private static Pattern PATTERN = Pattern.compile("^(\\s*return\\s+([^;]*);)\\s*$");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public ReturnOperation(){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int parse(String content, CleanerPool cleaner) throws Exception{
|
||||||
|
Matcher matcher = PATTERN.matcher(content);
|
||||||
|
matcher.matches();
|
||||||
|
|
||||||
|
this.value = matcher.group(2);
|
||||||
|
|
||||||
|
return matcher.group(1).length();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show(int tab){
|
||||||
|
String start = "";
|
||||||
|
for(int i = 0; i < tab; i++) start+="\t";
|
||||||
|
System.out.println(start+"return "+value+";");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -26,295 +26,295 @@ class VariableTest{
|
||||||
//Test<Test,K,L> j = new Test().schedule(p -> { return true;});
|
//Test<Test,K,L> j = new Test().schedule(p -> { return true;});
|
||||||
//int i =j=k=l=4;
|
//int i =j=k=l=4;
|
||||||
|
|
||||||
private CleanerPool cleaner;
|
// private CleanerPool cleaner;
|
||||||
|
//
|
||||||
@BeforeAll
|
// @BeforeAll
|
||||||
void init(){
|
// void init(){
|
||||||
this.cleaner = new CleanerPool();
|
// this.cleaner = new CleanerPool();
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void case1(){
|
|
||||||
try {
|
|
||||||
Variable variable = new Variable();
|
|
||||||
variable.parse(cleaner.clean(" int i = 4 ; "), cleaner);
|
|
||||||
|
|
||||||
assertEquals(0, variable.getModifier());
|
|
||||||
assertEquals("int", variable.getType());
|
|
||||||
assertEquals("i", variable.getName());
|
|
||||||
assertEquals("4", ((Value)variable.getValue()).value());
|
|
||||||
}catch(Exception e){
|
|
||||||
fail(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void case2(){
|
|
||||||
try {
|
|
||||||
Variable variable = new Variable();
|
|
||||||
variable.parse(cleaner.clean("public static int l ; "), cleaner);
|
|
||||||
|
|
||||||
assertEquals(JavaParser.getModifier("public")+JavaParser.getModifier("static"), variable.getModifier());
|
|
||||||
assertEquals("int", variable.getType());
|
|
||||||
assertEquals("l", variable.getName());
|
|
||||||
assertNull(variable.getValue());
|
|
||||||
}catch(Exception e){
|
|
||||||
fail(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void case3(){
|
|
||||||
try {
|
|
||||||
Variable variable = new Variable();
|
|
||||||
variable.parse(cleaner.clean(" int lm ; "), cleaner);
|
|
||||||
|
|
||||||
assertEquals(0, variable.getModifier());
|
|
||||||
assertEquals("int", variable.getType());
|
|
||||||
assertEquals("lm", variable.getName());
|
|
||||||
assertNull(variable.getValue());
|
|
||||||
}catch(Exception e){
|
|
||||||
fail(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void case4(){
|
|
||||||
try {
|
|
||||||
Variable variable = new Variable();
|
|
||||||
variable.parse(cleaner.clean("Test0< List< Map< Test1, List< Test2 >, Test3>> >t; "), cleaner);
|
|
||||||
|
|
||||||
assertEquals(0, variable.getModifier());
|
|
||||||
assertEquals("Test0<List<Map<Test1,List<Test2>,Test3>>>", variable.getType());
|
|
||||||
assertEquals("t", variable.getName());
|
|
||||||
assertNull(variable.getValue());
|
|
||||||
}catch(Exception e){
|
|
||||||
fail(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void case5(){
|
|
||||||
try {
|
|
||||||
Variable variable = new Variable();
|
|
||||||
variable.parse(cleaner.clean(" int i,j,k,l=1; "), cleaner);
|
|
||||||
|
|
||||||
assertEquals(0, variable.getModifier());
|
|
||||||
assertEquals("int", variable.getType());
|
|
||||||
assertEquals("i", variable.getName());
|
|
||||||
assertNull(variable.getValue());
|
|
||||||
}catch(Exception e){
|
|
||||||
fail(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void case6(){
|
|
||||||
try {
|
|
||||||
Class clazz = new Class();
|
|
||||||
clazz.parse(cleaner.clean("public class Test{ int i ,j,k,l=1; } "), cleaner);
|
|
||||||
|
|
||||||
List<Variable> vars = clazz.getVariables();
|
|
||||||
assertEquals(1, vars.size());
|
|
||||||
|
|
||||||
Variable v = vars.get(0);
|
|
||||||
assertEquals(0, v.getModifier());
|
|
||||||
assertEquals("int", v.getType());
|
|
||||||
// for(int i = 0; i < 3; i++){
|
|
||||||
// Variable v = vars.get(i);
|
|
||||||
// assertEquals(0, v.getModifier());
|
|
||||||
// assertEquals("int", v.getType());
|
|
||||||
// assertEquals((char)('i'+i), v.getName().charAt(0));
|
|
||||||
// assertNull(v.getValue());
|
|
||||||
// }
|
// }
|
||||||
// Variable v = vars.get(3);
|
//
|
||||||
// assertEquals(0, v.getModifier());
|
// @Test
|
||||||
// assertEquals("int", v.getType());
|
// void case1(){
|
||||||
// assertEquals('l', v.getName().charAt(0));
|
// try {
|
||||||
// assertEquals("1", ((Value)v.getValue()).value());
|
// Variable variable = new Variable();
|
||||||
}catch(Exception e){
|
// variable.parse(cleaner.clean(" int i = 4 ; "), cleaner);
|
||||||
fail(e);
|
//
|
||||||
}
|
// assertEquals(0, variable.getModifier());
|
||||||
}
|
// assertEquals("int", variable.getType());
|
||||||
|
// assertEquals("i", variable.getName());
|
||||||
@Test
|
// assertEquals("4", ((Value)variable.getValue()).value());
|
||||||
void case7(){
|
// }catch(Exception e){
|
||||||
try {
|
// fail(e);
|
||||||
Class clazz = new Class();
|
|
||||||
clazz.parse(cleaner.clean("public class Test{ int i ,j,k; int l=i=k=l=4; } "), new CleanerPool());
|
|
||||||
|
|
||||||
List<Variable> vars = clazz.getVariables();
|
|
||||||
assertEquals(2, vars.size());
|
|
||||||
Variable v = vars.get(0);
|
|
||||||
assertEquals(0, v.getModifier());
|
|
||||||
assertEquals("int", v.getType());
|
|
||||||
// for(int i = 0; i < 4; i++){
|
|
||||||
// Variable v = vars.get(i);
|
|
||||||
// assertEquals(0, v.getModifier());
|
|
||||||
// assertEquals("int", v.getType());
|
|
||||||
// assertEquals((char)('i'+i), v.getName().charAt(0));
|
|
||||||
// }
|
// }
|
||||||
}catch(Exception e){
|
// }
|
||||||
fail(e);
|
//
|
||||||
}
|
// @Test
|
||||||
}
|
// void case2(){
|
||||||
|
// try {
|
||||||
@Test
|
// Variable variable = new Variable();
|
||||||
void case8(){
|
// variable.parse(cleaner.clean("public static int l ; "), cleaner);
|
||||||
try {
|
//
|
||||||
Variable variable = new Variable();
|
// assertEquals(JavaParser.getModifier("public")+JavaParser.getModifier("static"), variable.getModifier());
|
||||||
variable.parse(cleaner.clean("int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]t; "), cleaner);
|
// assertEquals("int", variable.getType());
|
||||||
|
// assertEquals("l", variable.getName());
|
||||||
assertEquals(0, variable.getModifier());
|
// assertNull(variable.getValue());
|
||||||
assertEquals("int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", variable.getType());
|
// }catch(Exception e){
|
||||||
assertEquals("t", variable.getName());
|
// fail(e);
|
||||||
assertNull(variable.getValue());
|
// }
|
||||||
}catch(Exception e){
|
// }
|
||||||
fail(e);
|
//
|
||||||
}
|
// @Test
|
||||||
}
|
// void case3(){
|
||||||
|
// try {
|
||||||
@Test
|
// Variable variable = new Variable();
|
||||||
void case9(){
|
// variable.parse(cleaner.clean(" int lm ; "), cleaner);
|
||||||
try {
|
//
|
||||||
Class clazz = new Class();
|
// assertEquals(0, variable.getModifier());
|
||||||
clazz.parse(cleaner.clean("public class Test{ int i ,j,k,l; } "), cleaner);
|
// assertEquals("int", variable.getType());
|
||||||
|
// assertEquals("lm", variable.getName());
|
||||||
List<Variable> vars = clazz.getVariables();
|
// assertNull(variable.getValue());
|
||||||
assertEquals(1, vars.size());
|
// }catch(Exception e){
|
||||||
Variable v = vars.get(0);
|
// fail(e);
|
||||||
assertEquals(0, v.getModifier());
|
// }
|
||||||
assertEquals("int", v.getType());
|
// }
|
||||||
// for(int i = 0; i < 3; i++){
|
//
|
||||||
// Variable v = vars.get(i);
|
// @Test
|
||||||
|
// void case4(){
|
||||||
|
// try {
|
||||||
|
// Variable variable = new Variable();
|
||||||
|
// variable.parse(cleaner.clean("Test0< List< Map< Test1, List< Test2 >, Test3>> >t; "), cleaner);
|
||||||
|
//
|
||||||
|
// assertEquals(0, variable.getModifier());
|
||||||
|
// assertEquals("Test0<List<Map<Test1,List<Test2>,Test3>>>", variable.getType());
|
||||||
|
// assertEquals("t", variable.getName());
|
||||||
|
// assertNull(variable.getValue());
|
||||||
|
// }catch(Exception e){
|
||||||
|
// fail(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Test
|
||||||
|
// void case5(){
|
||||||
|
// try {
|
||||||
|
// Variable variable = new Variable();
|
||||||
|
// variable.parse(cleaner.clean(" int i,j,k,l=1; "), cleaner);
|
||||||
|
//
|
||||||
|
// assertEquals(0, variable.getModifier());
|
||||||
|
// assertEquals("int", variable.getType());
|
||||||
|
// assertEquals("i", variable.getName());
|
||||||
|
// assertNull(variable.getValue());
|
||||||
|
// }catch(Exception e){
|
||||||
|
// fail(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Test
|
||||||
|
// void case6(){
|
||||||
|
// try {
|
||||||
|
// Class clazz = new Class();
|
||||||
|
// clazz.parse(cleaner.clean("public class Test{ int i ,j,k,l=1; } "), cleaner);
|
||||||
|
//
|
||||||
|
// List<Variable> vars = clazz.getVariables();
|
||||||
|
// assertEquals(1, vars.size());
|
||||||
|
//
|
||||||
|
// Variable v = vars.get(0);
|
||||||
// assertEquals(0, v.getModifier());
|
// assertEquals(0, v.getModifier());
|
||||||
// assertEquals("int", v.getType());
|
// assertEquals("int", v.getType());
|
||||||
// assertEquals((char)('i'+i), v.getName().charAt(0));
|
//// for(int i = 0; i < 3; i++){
|
||||||
// assertNull(v.getValue());
|
//// Variable v = vars.get(i);
|
||||||
|
//// assertEquals(0, v.getModifier());
|
||||||
|
//// assertEquals("int", v.getType());
|
||||||
|
//// assertEquals((char)('i'+i), v.getName().charAt(0));
|
||||||
|
//// assertNull(v.getValue());
|
||||||
|
//// }
|
||||||
|
//// Variable v = vars.get(3);
|
||||||
|
//// assertEquals(0, v.getModifier());
|
||||||
|
//// assertEquals("int", v.getType());
|
||||||
|
//// assertEquals('l', v.getName().charAt(0));
|
||||||
|
//// assertEquals("1", ((Value)v.getValue()).value());
|
||||||
|
// }catch(Exception e){
|
||||||
|
// fail(e);
|
||||||
// }
|
// }
|
||||||
}catch(Exception e){
|
// }
|
||||||
fail(e);
|
//
|
||||||
}
|
// @Test
|
||||||
}
|
// void case7(){
|
||||||
|
// try {
|
||||||
@Test
|
// Class clazz = new Class();
|
||||||
void case10(){
|
// clazz.parse(cleaner.clean("public class Test{ int i ,j,k; int l=i=k=l=4; } "), new CleanerPool());
|
||||||
try {
|
//
|
||||||
Variable variable = new Variable();
|
// List<Variable> vars = clazz.getVariables();
|
||||||
variable.parse(cleaner.clean(" boolean i = j << 3==0 ; "), cleaner);
|
// assertEquals(2, vars.size());
|
||||||
|
// Variable v = vars.get(0);
|
||||||
assertEquals(0, variable.getModifier());
|
// assertEquals(0, v.getModifier());
|
||||||
assertEquals("boolean", variable.getType());
|
// assertEquals("int", v.getType());
|
||||||
assertEquals("i", variable.getName());
|
//// for(int i = 0; i < 4; i++){
|
||||||
assertEquals("j<< 3 == 0", ((Value)variable.getValue()).value());
|
//// Variable v = vars.get(i);
|
||||||
}catch(Exception e){
|
//// assertEquals(0, v.getModifier());
|
||||||
fail(e);
|
//// assertEquals("int", v.getType());
|
||||||
}
|
//// assertEquals((char)('i'+i), v.getName().charAt(0));
|
||||||
}
|
//// }
|
||||||
|
// }catch(Exception e){
|
||||||
@Test
|
// fail(e);
|
||||||
void case11(){
|
// }
|
||||||
|
// }
|
||||||
try {
|
//
|
||||||
Variable variable = new Variable();
|
// @Test
|
||||||
variable.parse(cleaner.clean("java.util.function.Function<Integer, Integer> j = ((i) -> {return 4;});"), cleaner);
|
// void case8(){
|
||||||
|
// try {
|
||||||
assertEquals(0, variable.getModifier());
|
// Variable variable = new Variable();
|
||||||
assertEquals("java.util.function.Function<Integer,Integer>", variable.getType());
|
// variable.parse(cleaner.clean("int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]t; "), cleaner);
|
||||||
assertEquals("j", variable.getName());
|
//
|
||||||
assertEquals("((i) -> {return 4;})", ((Value)variable.getValue()).value());
|
// assertEquals(0, variable.getModifier());
|
||||||
}catch(Exception e){
|
// assertEquals("int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", variable.getType());
|
||||||
fail(e);
|
// assertEquals("t", variable.getName());
|
||||||
}
|
// assertNull(variable.getValue());
|
||||||
}
|
// }catch(Exception e){
|
||||||
|
// fail(e);
|
||||||
@Test
|
// }
|
||||||
void case12(){
|
// }
|
||||||
|
//
|
||||||
try {
|
// @Test
|
||||||
Variable variable = new Variable();
|
// void case9(){
|
||||||
variable.parse(cleaner.clean(" public static final Locale FRENCH = createConstant(\"fr\", \"\");"), cleaner);
|
// try {
|
||||||
|
// Class clazz = new Class();
|
||||||
assertEquals(JavaParser.getModifier("public")+JavaParser.getModifier("static")+JavaParser.getModifier("final"), variable.getModifier());
|
// clazz.parse(cleaner.clean("public class Test{ int i ,j,k,l; } "), cleaner);
|
||||||
assertEquals("Locale", variable.getType());
|
//
|
||||||
assertEquals("FRENCH", variable.getName());
|
// List<Variable> vars = clazz.getVariables();
|
||||||
assertEquals("createConstant(\"fr\",\"\")", ((Value)variable.getValue()).value());
|
// assertEquals(1, vars.size());
|
||||||
}catch(Exception e){
|
// Variable v = vars.get(0);
|
||||||
fail(e);
|
// assertEquals(0, v.getModifier());
|
||||||
}
|
// assertEquals("int", v.getType());
|
||||||
}
|
//// for(int i = 0; i < 3; i++){
|
||||||
|
//// Variable v = vars.get(i);
|
||||||
@Test
|
//// assertEquals(0, v.getModifier());
|
||||||
void case13(){
|
//// assertEquals("int", v.getType());
|
||||||
|
//// assertEquals((char)('i'+i), v.getName().charAt(0));
|
||||||
try {
|
//// assertNull(v.getValue());
|
||||||
Variable variable = new Variable();
|
//// }
|
||||||
variable.parse(cleaner.clean("private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[] { new ObjectStreamField(\"language\", String.class), new ObjectStreamField(\"country\", String.class), new ObjectStreamField(\"variant\", String.class), new ObjectStreamField(\"hashcode\", int.class), new ObjectStreamField(\"script\", String.class), new ObjectStreamField(\"extensions\", String.class) };"), cleaner);
|
// }catch(Exception e){
|
||||||
|
// fail(e);
|
||||||
assertEquals(JavaParser.getModifier("private")+JavaParser.getModifier("static")+JavaParser.getModifier("final"), variable.getModifier());
|
// }
|
||||||
assertEquals("ObjectStreamField[]", variable.getType());
|
// }
|
||||||
assertEquals("serialPersistentFields", variable.getName());
|
//
|
||||||
assertEquals("new ObjectStreamField[] { new ObjectStreamField(\"language\", String.class), new ObjectStreamField(\"country\", String.class), new ObjectStreamField(\"variant\", String.class), new ObjectStreamField(\"hashcode\", int.class), new ObjectStreamField(\"script\", String.class), new ObjectStreamField(\"extensions\", String.class) }", ((Value)variable.getValue()).value());
|
// @Test
|
||||||
}catch(Exception e){
|
// void case10(){
|
||||||
fail(e);
|
// try {
|
||||||
}
|
// Variable variable = new Variable();
|
||||||
}
|
// variable.parse(cleaner.clean(" boolean i = j << 3==0 ; "), cleaner);
|
||||||
|
//
|
||||||
@Test
|
// assertEquals(0, variable.getModifier());
|
||||||
void case14(){
|
// assertEquals("boolean", variable.getType());
|
||||||
|
// assertEquals("i", variable.getName());
|
||||||
|
// assertEquals("j<< 3 == 0", ((Value)variable.getValue()).value());
|
||||||
try {
|
// }catch(Exception e){
|
||||||
Class clazz = new Class();
|
// fail(e);
|
||||||
clazz.parse(cleaner.clean("public class Test{ private java.util.function.Function<Integer, Integer> j = ((i) -> {return 4;}), k = ((i) -> 4); } "), cleaner);
|
// }
|
||||||
|
// }
|
||||||
List<Variable> vars = clazz.getVariables();
|
//
|
||||||
assertEquals(1, vars.size());
|
// @Test
|
||||||
Variable variable;
|
// void case11(){
|
||||||
variable = vars.get(0);
|
//
|
||||||
assertTrue(variable instanceof MultipleDeclaratedVariable);
|
// try {
|
||||||
assertEquals(JavaParser.getModifier("private"), variable.getModifier());
|
// Variable variable = new Variable();
|
||||||
assertEquals("java.util.function.Function<Integer,Integer>", variable.getType());
|
// variable.parse(cleaner.clean("java.util.function.Function<Integer, Integer> j = ((i) -> {return 4;});"), cleaner);
|
||||||
|
//
|
||||||
|
// assertEquals(0, variable.getModifier());
|
||||||
|
// assertEquals("java.util.function.Function<Integer,Integer>", variable.getType());
|
||||||
// assertEquals("j", variable.getName());
|
// assertEquals("j", variable.getName());
|
||||||
// assertEquals("((i) -> {return 4;})", ((Value)variable.getValue()).value());
|
// assertEquals("((i) -> {return 4;})", ((Value)variable.getValue()).value());
|
||||||
|
// }catch(Exception e){
|
||||||
|
// fail(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
//
|
//
|
||||||
// variable = vars.get(1);
|
// @Test
|
||||||
|
// void case12(){
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// Variable variable = new Variable();
|
||||||
|
// variable.parse(cleaner.clean(" public static final Locale FRENCH = createConstant(\"fr\", \"\");"), cleaner);
|
||||||
|
//
|
||||||
|
// assertEquals(JavaParser.getModifier("public")+JavaParser.getModifier("static")+JavaParser.getModifier("final"), variable.getModifier());
|
||||||
|
// assertEquals("Locale", variable.getType());
|
||||||
|
// assertEquals("FRENCH", variable.getName());
|
||||||
|
// assertEquals("createConstant(\"fr\",\"\")", ((Value)variable.getValue()).value());
|
||||||
|
// }catch(Exception e){
|
||||||
|
// fail(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Test
|
||||||
|
// void case13(){
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// Variable variable = new Variable();
|
||||||
|
// variable.parse(cleaner.clean("private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[] { new ObjectStreamField(\"language\", String.class), new ObjectStreamField(\"country\", String.class), new ObjectStreamField(\"variant\", String.class), new ObjectStreamField(\"hashcode\", int.class), new ObjectStreamField(\"script\", String.class), new ObjectStreamField(\"extensions\", String.class) };"), cleaner);
|
||||||
|
//
|
||||||
|
// assertEquals(JavaParser.getModifier("private")+JavaParser.getModifier("static")+JavaParser.getModifier("final"), variable.getModifier());
|
||||||
|
// assertEquals("ObjectStreamField[]", variable.getType());
|
||||||
|
// assertEquals("serialPersistentFields", variable.getName());
|
||||||
|
// assertEquals("new ObjectStreamField[] { new ObjectStreamField(\"language\", String.class), new ObjectStreamField(\"country\", String.class), new ObjectStreamField(\"variant\", String.class), new ObjectStreamField(\"hashcode\", int.class), new ObjectStreamField(\"script\", String.class), new ObjectStreamField(\"extensions\", String.class) }", ((Value)variable.getValue()).value());
|
||||||
|
// }catch(Exception e){
|
||||||
|
// fail(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Test
|
||||||
|
// void case14(){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// Class clazz = new Class();
|
||||||
|
// clazz.parse(cleaner.clean("public class Test{ private java.util.function.Function<Integer, Integer> j = ((i) -> {return 4;}), k = ((i) -> 4); } "), cleaner);
|
||||||
|
//
|
||||||
|
// List<Variable> vars = clazz.getVariables();
|
||||||
|
// assertEquals(1, vars.size());
|
||||||
|
// Variable variable;
|
||||||
|
// variable = vars.get(0);
|
||||||
|
// assertTrue(variable instanceof MultipleDeclaratedVariable);
|
||||||
// assertEquals(JavaParser.getModifier("private"), variable.getModifier());
|
// assertEquals(JavaParser.getModifier("private"), variable.getModifier());
|
||||||
// assertEquals("java.util.function.Function<Integer,Integer>", variable.getType());
|
// assertEquals("java.util.function.Function<Integer,Integer>", variable.getType());
|
||||||
// assertEquals("k", variable.getName());
|
//// assertEquals("j", variable.getName());
|
||||||
// assertEquals("((i) -> 4)", ((Value)variable.getValue()).value());
|
//// assertEquals("((i) -> {return 4;})", ((Value)variable.getValue()).value());
|
||||||
}catch(Exception e){
|
////
|
||||||
fail(e);
|
//// variable = vars.get(1);
|
||||||
}
|
//// assertEquals(JavaParser.getModifier("private"), variable.getModifier());
|
||||||
}
|
//// assertEquals("java.util.function.Function<Integer,Integer>", variable.getType());
|
||||||
|
//// assertEquals("k", variable.getName());
|
||||||
@Test
|
//// assertEquals("((i) -> 4)", ((Value)variable.getValue()).value());
|
||||||
void case15(){
|
// }catch(Exception e){
|
||||||
try {
|
// fail(e);
|
||||||
Variable variable = new Variable();
|
// }
|
||||||
variable.parse(cleaner.clean(" List <String> list = new ArrayList <> () ; "), cleaner);
|
// }
|
||||||
|
//
|
||||||
assertEquals(0, variable.getModifier());
|
// @Test
|
||||||
assertEquals("List<String>", variable.getType());
|
// void case15(){
|
||||||
assertEquals("list", variable.getName());
|
// try {
|
||||||
assertEquals("new ArrayList<>()", ((Value)variable.getValue()).value());
|
// Variable variable = new Variable();
|
||||||
}catch(Exception e){
|
// variable.parse(cleaner.clean(" List <String> list = new ArrayList <> () ; "), cleaner);
|
||||||
fail(e);
|
//
|
||||||
}
|
// assertEquals(0, variable.getModifier());
|
||||||
}
|
// assertEquals("List<String>", variable.getType());
|
||||||
|
// assertEquals("list", variable.getName());
|
||||||
@Test
|
// assertEquals("new ArrayList<>()", ((Value)variable.getValue()).value());
|
||||||
void case16(){
|
// }catch(Exception e){
|
||||||
try {
|
// fail(e);
|
||||||
Variable variable = new Variable();
|
// }
|
||||||
variable.parse(cleaner.clean(" List <String> a [] = new ArrayList [ 0] ; "), cleaner);
|
// }
|
||||||
|
//
|
||||||
assertEquals(0, variable.getModifier());
|
// @Test
|
||||||
assertEquals("List<String>", variable.getType());
|
// void case16(){
|
||||||
assertEquals("a[]", variable.getName());
|
// try {
|
||||||
assertEquals("new ArrayList[0]", ((Value)variable.getValue()).value());
|
// Variable variable = new Variable();
|
||||||
}catch(Exception e){
|
// variable.parse(cleaner.clean(" List <String> a [] = new ArrayList [ 0] ; "), cleaner);
|
||||||
fail(e);
|
//
|
||||||
}
|
// assertEquals(0, variable.getModifier());
|
||||||
}
|
// assertEquals("List<String>", variable.getType());
|
||||||
|
// assertEquals("a[]", variable.getName());
|
||||||
|
// assertEquals("new ArrayList[0]", ((Value)variable.getValue()).value());
|
||||||
|
// }catch(Exception e){
|
||||||
|
// fail(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue