-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix various 5.11 build errors (#3722)
* Fix various 5.11 build errors * small comment changes * excluded some hadoop deps to avoid conflict with neo4j 5.11 lib deps * Fix failing path traversal CI tests * Add explicit mockito test dependency * Generalized html with js error - it depends on the driver version * added parquet procs to extended.txt * wip - include only StartupExtendedTest * restored build.gradle * Added Extended annotation * Added Extended annotation * Added Extended annotation * Updated com.diffplug.spotless version * restore spotless * Fix custom proc with homonyms
- Loading branch information
Showing
13 changed files
with
157 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
extended/src/main/java/org/neo4j/procedure/impl/ProcedureHolderUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.neo4j.procedure.impl; | ||
|
||
import org.neo4j.internal.kernel.api.procs.QualifiedName; | ||
import org.neo4j.kernel.api.procedure.GlobalProcedures; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
public class ProcedureHolderUtils { | ||
|
||
public static void unregisterProcedure(QualifiedName name, GlobalProcedures registry) { | ||
String kind = "procedures"; | ||
unregisterCommon(name, registry, kind); | ||
} | ||
|
||
public static void unregisterFunction(QualifiedName name, GlobalProcedures registry) { | ||
String kind = "functions"; | ||
unregisterCommon(name, registry, kind); | ||
} | ||
|
||
private static void unregisterCommon(QualifiedName name, GlobalProcedures registry, String kind) { | ||
try { | ||
GlobalProceduresRegistry globalProcRegistry = getGlobalProcRegistry(registry); | ||
|
||
// get the field `ProcedureRegistry registry` from the GlobalProceduresRegistry instance | ||
Field registryField = GlobalProceduresRegistry.class.getDeclaredField("registry"); | ||
registryField.setAccessible(true); | ||
ProcedureRegistry procedureRegistry = (ProcedureRegistry) registryField.get(globalProcRegistry); | ||
|
||
// get `ProcedureHolder <kind>` (i.e `ProcedureHolder procedures` or `ProcedureHolder functions`) field from the ProcedureRegistry instance | ||
Field procHolderField = ProcedureRegistry.class.getDeclaredField(kind); | ||
procHolderField.setAccessible(true); | ||
ProcedureHolder procedureHolder = (ProcedureHolder) procHolderField.get(procedureRegistry); | ||
|
||
// unregister `name` from ProcedureHolder found | ||
procedureHolder.unregister(name); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
private static GlobalProceduresRegistry getGlobalProcRegistry(GlobalProcedures registry) { | ||
try { | ||
// with embedded test database, the instance is of type LazyProcedures, | ||
// so we get the field `globalProcedures` from the `LazyProcedures registry` instance | ||
Field globalProceduresField = Class.forName("org.neo4j.procedure.LazyProcedures").getDeclaredField("globalProcedures"); | ||
globalProceduresField.setAccessible(true); | ||
|
||
return (GlobalProceduresRegistry) globalProceduresField.get(registry); | ||
|
||
} catch (Exception e) { | ||
// with a real instance, the above code produces, due to LazyProcedures, produce a `NoClassDefFoundError` or an `IllegalArgumentException` | ||
// because `registry` is directly of type GlobalProceduresRegistry, so we cast it | ||
return (GlobalProceduresRegistry) registry; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters