Details
-
Bug
-
Status: Resolved
-
Resolution: Duplicate
-
None
-
None
-
None
-
None
-
Operating System: Linux
Platform: PC
-
1194
Description
We're calling things like new Long("1") with a string constant. Here we should use Long.valueOf(1L) rather than calling the constructor, and we shouldn't use a string we should use a constant. At a minimum this should be Long.valueOf("1") if somehow we can't properly generate the constant value.
Here's something that shows up in some generated code:
public static List<Range<Long>> length()
{ final List<Range<Long>> result = new ArrayList<>(); result.add(Range.closed(new Long("1"), new Long("4096"))); return result; }Here's another example:
public RuleBuilder setOrder(Integer value) {
if (value != null) {
boolean isValidRange = false;
List<Range<Integer>> rangeConstraints = new ArrayList<>();
rangeConstraints.add(Range.closed(new Integer("0"), new Integer("2147483647")));
for (Range<Integer> r : rangeConstraints) {
if (r.contains(value))
}
if (!isValidRange)
}
this._order = value;
return this;
}
Attachments
Issue Links
- duplicates
-
YANGTOOLS-177 Optimize generated range checks
- Resolved