Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions runtime/Java/src/org/antlr/v4/runtime/ANTLRFileStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*
* @deprecated as of 4.7 Please use {@link CharStreams} interface.
*/
@Deprecated
public class ANTLRFileStream extends ANTLRInputStream {
protected String fileName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*
* @deprecated as of 4.7 Please use {@link CharStreams} interface.
*/
@Deprecated
public class ANTLRInputStream implements CharStream {
public static final int READ_BUFFER_SIZE = 1024;
public static final int INITIAL_BUFFER_SIZE = 1024;
Expand Down
3 changes: 1 addition & 2 deletions runtime/Java/src/org/antlr/v4/runtime/CommonToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ public String toString() {
return toString(null);
}

public String toString(Recognizer r) {

public String toString(Recognizer<?, ?> r) {
String channelStr = "";
if ( channel>0 ) {
channelStr=",channel="+channel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,7 @@ protected LexerAction lexerActionFactory(LexerActionType type, int data1, int da
return new LexerTypeAction(data1);

default:
String message = String.format(Locale.getDefault(), "The specified lexer action type %d is not valid.", type);
throw new IllegalArgumentException(message);
throw new IllegalArgumentException(String.format(Locale.getDefault(), "The specified lexer action type %s is not valid.", type));
}
}
}
1 change: 1 addition & 0 deletions runtime/Java/src/org/antlr/v4/runtime/misc/NotNull.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
@Deprecated
public @interface NotNull {
}
1 change: 1 addition & 0 deletions runtime/Java/src/org/antlr/v4/runtime/misc/TestRig.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @deprecated
* @since 4.5.1
*/
@Deprecated
public class TestRig {
public static void main(String[] args) {
try {
Expand Down
1 change: 1 addition & 0 deletions runtime/Java/src/org/antlr/v4/runtime/tree/Trees.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ public static List<ParseTree> getDescendants(ParseTree t) {
}

/** @deprecated */
@Deprecated
public static List<ParseTree> descendants(ParseTree t) {
return getDescendants(t);
}
Expand Down
4 changes: 3 additions & 1 deletion tool/src/org/antlr/v4/codegen/target/GoTarget.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public String encodeIntAsCharEscape(int v) {

@Override
public int getSerializedATNSegmentLimit() {
return 2 ^ 31;
// 65535 is the class file format byte limit for a UTF-8 encoded string literal
// 3 is the maximum number of bytes it takes to encode a value in the range 0-0xFFFF
return 65535 / 3;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions tool/src/org/antlr/v4/misc/MutableInt.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package org.antlr.v4.misc;

public class MutableInt extends Number implements Comparable<Number> {
public class MutableInt extends Number implements Comparable<MutableInt> {
public int v;

public MutableInt(int v) { this.v = v; }
Expand All @@ -19,7 +19,7 @@ public boolean equals(Object o) {

@Override public int hashCode() { return v; }

@Override public int compareTo(Number o) { return v-o.intValue(); }
@Override public int compareTo(MutableInt o) { return v-o.intValue(); }
@Override public int intValue() { return v; }
@Override public long longValue() { return v; }
@Override public float floatValue() { return v; }
Expand Down
4 changes: 3 additions & 1 deletion tool/src/org/antlr/v4/tool/ErrorManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public ST getMessageTemplate(ANTLRMessage msg) {
}
if (msg.fileName != null) {
String displayFileName = msg.fileName;
if (format.equals("antlr")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow. weird that we never ran into this. seems like this would never be true.

if (formatName.equals("antlr")) {
// Don't show path to file in messages in ANTLR format;
// they're too long.
File f = new File(msg.fileName);
Expand Down Expand Up @@ -206,6 +206,8 @@ public void emit(ErrorType etype, ANTLRMessage msg) {
errors++;
tool.error(msg);
break;
default:
break;
}
errorTypes.add(etype);
}
Expand Down