Search in sources :

Example 1 with Java5Validator

use of com.github.javaparser.ast.validator.Java5Validator in project javaparser by javaparser.

the class TypeTest method primitiveTypeArgumentLenientValidator.

@Test
public void primitiveTypeArgumentLenientValidator() {
    ParserConfiguration config = new ParserConfiguration().setLanguageLevel(RAW);
    config.getPostProcessors().add(new Java5Validator() {

        {
            remove(noPrimitiveGenericArguments);
        }
    }.postProcessor());
    ParseResult<VariableDeclarationExpr> result = new JavaParser(config).parse(VARIABLE_DECLARATION_EXPR, provider("List<long> x"));
    assertTrue(result.isSuccessful());
    VariableDeclarationExpr decl = result.getResult().get();
    assertEquals("List<long>", decl.getVariable(0).getType().asString());
}
Also used : JavaParser(com.github.javaparser.JavaParser) VariableDeclarationExpr(com.github.javaparser.ast.expr.VariableDeclarationExpr) JavaParser.parseVariableDeclarationExpr(com.github.javaparser.JavaParser.parseVariableDeclarationExpr) Java5Validator(com.github.javaparser.ast.validator.Java5Validator) ParserConfiguration(com.github.javaparser.ParserConfiguration) Test(org.junit.Test)

Aggregations

JavaParser (com.github.javaparser.JavaParser)1 JavaParser.parseVariableDeclarationExpr (com.github.javaparser.JavaParser.parseVariableDeclarationExpr)1 ParserConfiguration (com.github.javaparser.ParserConfiguration)1 VariableDeclarationExpr (com.github.javaparser.ast.expr.VariableDeclarationExpr)1 Java5Validator (com.github.javaparser.ast.validator.Java5Validator)1 Test (org.junit.Test)1