Package org.eclipse.xtext.parser.antlr
Class LexerProvider<T extends org.antlr.runtime.Lexer>
- java.lang.Object
-
- org.eclipse.xtext.parser.antlr.LexerProvider<T>
-
- All Implemented Interfaces:
com.google.inject.Provider<T>,javax.inject.Provider<T>
public class LexerProvider<T extends org.antlr.runtime.Lexer> extends java.lang.Object implements com.google.inject.Provider<T>A Guice provider implementation, that does not use the default constructor of the lexer class, but call the other available constructor that takes a CharStream as argument. This provider is a workaround for a bug in ANTLR that leads to partially initialized Lexer instances. They may cause NullPointerExceptions in some rare situations, when backtracking is involved.
-
-
Constructor Summary
Constructors Constructor Description LexerProvider(java.lang.Class<T> clazz)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends org.antlr.runtime.Lexer>
LexerProvider<T>create(java.lang.Class<T> clazz)Tget()Creates a lexer instance via reflection.
-
-
-
Constructor Detail
-
LexerProvider
public LexerProvider(java.lang.Class<T> clazz)
-
-
Method Detail
-
create
public static <T extends org.antlr.runtime.Lexer> LexerProvider<T> create(java.lang.Class<T> clazz)
-
get
public T get()
Creates a lexer instance via reflection. The object is not created with the default constructor because it will not initialize the backtracking state of the lexer. Instead, we passnullas CharStream argument.
-
-