diff --git a/src/be/jeffcheasey88/peeratcode/parser/java/Variable.java b/src/be/jeffcheasey88/peeratcode/parser/java/Variable.java index 31b3403..1a96376 100644 --- a/src/be/jeffcheasey88/peeratcode/parser/java/Variable.java +++ b/src/be/jeffcheasey88/peeratcode/parser/java/Variable.java @@ -24,7 +24,9 @@ public class Variable { public int parse(String content, CleanerPool cleaner) throws Exception{ System.out.println("parse "+content); - CleanerPool generic = new CleanerPool(new Cleaner("GENERIC_TYPE_",'<','>')); + CleanerPool generic = new CleanerPool( + new Cleaner("GENERIC_TYPE_",'<','>'), + new Cleaner("GENERIC_ARRAY",'[',']')); content = generic.clean(content); System.out.println("clean "+content); @@ -72,7 +74,10 @@ public class Variable { } private String generiqueTypes(String content, CleanerPool cleaner){ - return cleaner.unzip(content, (s) -> s.replaceAll("\\s+", "")).replaceAll(">(?[^>\\d,;])", "> ${varname}"); + return cleaner. + unzip(content, (s) -> s.replaceAll("\\s+", "")). + replaceAll(">(?[^>\\d,;])", "> ${varname}"). + replaceAll("](?[^\\[\\d,;])", "] ${varname}"); } private int indexOf(String value, String target){ diff --git a/test/be/jeffcheasey88/peeratcode/parser/java/VariableTest.java b/test/be/jeffcheasey88/peeratcode/parser/java/VariableTest.java index bc5f28c..dabbb89 100644 --- a/test/be/jeffcheasey88/peeratcode/parser/java/VariableTest.java +++ b/test/be/jeffcheasey88/peeratcode/parser/java/VariableTest.java @@ -152,4 +152,19 @@ class VariableTest{ } } + @Test + void case8(){ + try { + Variable variable = new Variable(); + variable.parse(cleaner.clean("int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]t; "), cleaner); + + assertEquals(0, variable.getModifier()); + assertEquals("int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", variable.getType()); + assertEquals("t", variable.getName()); + assertNull(variable.getValue()); + }catch(Exception e){ + fail(e); + } + } + }