[core] Call SymbolFacade without classloader by default

This allows languages, that don't need a classloader while creating
symbol table to just override the one method.
In the test, we call always the overloaded method with class loader
with made the symbol table processing not being run for tests
in plsql.

Fixes #2325
This commit is contained in:
Andreas Dangel
2020-03-06 10:59:02 +01:00
parent 38ce869b12
commit 4468db2428
6 changed files with 41 additions and 10 deletions

View File

@ -92,6 +92,7 @@ should give more accurate results and especially fixes the problems with the usi
* java-performance
* [#2275](https://github.com/pmd/pmd/issues/2275): \[java] AppendCharacterWithChar flags literals in an expression
* plsql
* [#2325](https://github.com/pmd/pmd/issues/2325): \[plsql] NullPointerException while running parsing test for CREATE TRIGGER
* [#2327](https://github.com/pmd/pmd/pull/2327): \[plsql] Parsing of WHERE CURRENT OF
* [#2328](https://github.com/pmd/pmd/issues/2328): \[plsql] Support XMLROOT
* [#2331](https://github.com/pmd/pmd/pull/2331): \[plsql] Fix in Comment statement

View File

@ -45,7 +45,7 @@ public abstract class AbstractLanguageVersionHandler implements LanguageVersionH
@Override
public VisitorStarter getSymbolFacade(ClassLoader classLoader) {
return VisitorStarter.DUMMY;
return getSymbolFacade();
}
@Override

View File

@ -143,8 +143,3 @@ public abstract class AbstractPLSQLNode extends AbstractJjtreeNode<PLSQLNode> im
this.scope = scope;
}
}
/*
* JavaCC - OriginalChecksum=3f651517d5069f856891d89230562ac4 (do not edit this
* line)
*/

View File

@ -7,15 +7,14 @@ package net.sourceforge.pmd.lang.plsql.ast;
import org.junit.Assert;
import org.junit.Test;
import net.sourceforge.pmd.lang.plsql.PlsqlParsingHelper;
import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst;
public class ASTExtractExpressionTest {
public class ASTExtractExpressionTest extends AbstractPLSQLParserTst {
@Test
public void testXml() {
PlsqlParsingHelper parser = PlsqlParsingHelper.JUST_PARSE;
ASTInput unit = parser.parse("SELECT warehouse_name, EXTRACT(warehouse_spec, '/Warehouse/Docks', "
ASTInput unit = plsql.parse("SELECT warehouse_name, EXTRACT(warehouse_spec, '/Warehouse/Docks', "
+ "'xmlns:a=\"http://warehouse/1\" xmlns:b=\"http://warehouse/2\"') \"Number of Docks\" "
+ " FROM warehouses WHERE warehouse_spec IS NOT NULL;");
ASTExtractExpression extract = unit.getFirstDescendantOfType(ASTExtractExpression.class);

View File

@ -0,0 +1,28 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.plsql.ast;
import org.junit.Assert;
import org.junit.Test;
import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst;
public class TriggerTest extends AbstractPLSQLParserTst {
/**
* Parsing a trigger should not result in a NPE.
*
* @see <a href="https://github.com/pmd/pmd/issues/2325">#2325 [plsql] NullPointerException while running parsing test for CREATE TRIGGER</a>
*/
@Test
public void parseCreateTrigger() {
ASTInput input = plsql.parseResource("TriggerUnit.pls");
PLSQLNode trigger = input.getChild(0);
Assert.assertEquals(ASTTriggerUnit.class, trigger.getClass());
Assert.assertNotNull(trigger.getScope());
}
}

View File

@ -0,0 +1,8 @@
create or replace trigger test_trigger
instead of update
on test_table
for each row
begin
test.clr;
end;
/