Skip to content

Commit

Permalink
Indicate that we're doing a conversion, not just a get.
Browse files Browse the repository at this point in the history
  • Loading branch information
matozoid committed May 22, 2017
1 parent 58dc3c0 commit cb5460c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Expand Up @@ -24,7 +24,7 @@ public JavaToken getEnd() {
return end; return end;
} }


public Range getRange() { public Range toRange() {
return new Range(begin.getRange().begin, end.getRange().end); return new Range(begin.getRange().begin, end.getRange().end);
} }


Expand Down
Expand Up @@ -113,7 +113,7 @@ public static Type wrapInArrayTypes(Type type, List<ArrayBracketPair>... arrayBr
} }
type = new ArrayType(tokenRange, type, pair.getAnnotations()); type = new ArrayType(tokenRange, type, pair.getAnnotations());
if (tokenRange != null) { if (tokenRange != null) {
type.setRange(tokenRange.getRange()); type.setRange(tokenRange.toRange());
} }
} }
} }
Expand Down
Expand Up @@ -94,7 +94,7 @@ public void parseErrorContainsLocation() {
ParseResult<CompilationUnit> result = new JavaParser().parse(COMPILATION_UNIT, Providers.provider("class X { // blah")); ParseResult<CompilationUnit> result = new JavaParser().parse(COMPILATION_UNIT, Providers.provider("class X { // blah"));


Problem problem = result.getProblem(0); Problem problem = result.getProblem(0);
assertEquals(range(1, 9, 1, 9), problem.getLocation().get().getRange()); assertEquals(range(1, 9, 1, 9), problem.getLocation().get().toRange());
assertEquals("Parse error. Found <EOF>, expected one of \";\" \"<\" \"@\" \"abstract\" \"boolean\" \"byte\" \"char\" \"class\" \"default\" \"double\" \"enum\" \"exports\" \"final\" \"float\" \"int\" \"interface\" \"long\" \"module\" \"native\" \"open\" \"opens\" \"private\" \"protected\" \"provides\" \"public\" \"requires\" \"short\" \"static\" \"strictfp\" \"synchronized\" \"to\" \"transient\" \"transitive\" \"uses\" \"void\" \"volatile\" \"with\" \"{\" \"}\" <IDENTIFIER>", problem.getMessage()); assertEquals("Parse error. Found <EOF>, expected one of \";\" \"<\" \"@\" \"abstract\" \"boolean\" \"byte\" \"char\" \"class\" \"default\" \"double\" \"enum\" \"exports\" \"final\" \"float\" \"int\" \"interface\" \"long\" \"module\" \"native\" \"open\" \"opens\" \"private\" \"protected\" \"provides\" \"public\" \"requires\" \"short\" \"static\" \"strictfp\" \"synchronized\" \"to\" \"transient\" \"transitive\" \"uses\" \"void\" \"volatile\" \"with\" \"{\" \"}\" <IDENTIFIER>", problem.getMessage());
assertInstanceOf(ParseException.class, problem.getCause().get()); assertInstanceOf(ParseException.class, problem.getCause().get());
} }
Expand Down

0 comments on commit cb5460c

Please sign in to comment.