diff --git a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/executionplan/GeneratedQuery.java b/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/executionplan/GeneratedQuery.java index 82a5f9de99f15..0fcab5e5e1788 100644 --- a/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/executionplan/GeneratedQuery.java +++ b/community/cypher/cypher-compiler-3.0/src/main/java/org/neo4j/cypher/internal/compiler/v3_0/executionplan/GeneratedQuery.java @@ -20,7 +20,6 @@ package org.neo4j.cypher.internal.compiler.v3_0.executionplan; import java.util.Map; -import java.util.function.Supplier; import org.neo4j.cypher.internal.compiler.v3_0.ExecutionMode; import org.neo4j.cypher.internal.compiler.v3_0.TaskCloser; @@ -36,7 +35,7 @@ GeneratedQueryExecution execute( Statement statement, NodeManager nodeManager, ExecutionMode executionMode, - Supplier description, + org.neo4j.function.Supplier description, QueryExecutionTracer tracer, Map params ); } diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenerator.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenerator.scala index f1b2a768345ad..c4f285768baf0 100644 --- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenerator.scala +++ b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/CodeGenerator.scala @@ -21,7 +21,6 @@ package org.neo4j.cypher.internal.compiler.v3_0.codegen import java.lang.Boolean.getBoolean import java.util -import java.util.function.Supplier import org.neo4j.cypher.internal.compiler.v3_0.codegen.CodeGenerator.SourceSink import org.neo4j.cypher.internal.compiler.v3_0.codegen.ir._ @@ -45,7 +44,7 @@ class CodeGenerator(val structure: CodeStructure[GeneratedQuery]) { import CodeGenerator.generateCode - type PlanDescriptionProvider = (InternalPlanDescription) => (Supplier[InternalPlanDescription], Option[QueryExecutionTracer]) + type PlanDescriptionProvider = (InternalPlanDescription) => (org.neo4j.function.Supplier[InternalPlanDescription], Option[QueryExecutionTracer]) def generate(plan: LogicalPlan, planContext: PlanContext, clock: Clock, semanticTable: SemanticTable, plannerName: PlannerName) = { plan match { diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/CompiledExecutionResult.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/CompiledExecutionResult.scala index 48e9790692911..e68a152184b26 100644 --- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/CompiledExecutionResult.scala +++ b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/CompiledExecutionResult.scala @@ -21,7 +21,6 @@ package org.neo4j.cypher.internal.compiler.v3_0.executionplan import java.io.{PrintWriter, StringWriter} import java.util -import java.util.function.Supplier import org.neo4j.cypher.internal.compiler.v3_0._ import org.neo4j.cypher.internal.compiler.v3_0.commands.values.KeyToken @@ -51,7 +50,7 @@ trait SuccessfulCloseable { class CompiledExecutionResult(taskCloser: TaskCloser, statement: Statement, compiledCode: GeneratedQueryExecution, - description: Supplier[InternalPlanDescription]) + description: org.neo4j.function.Supplier[InternalPlanDescription]) extends InternalExecutionResult with SuccessfulCloseable { self => diff --git a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/ExecutionPlanBuilder.scala b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/ExecutionPlanBuilder.scala index 397b3dc92bc5c..d036c04e9eeba 100644 --- a/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/ExecutionPlanBuilder.scala +++ b/community/cypher/cypher-compiler-3.0/src/main/scala/org/neo4j/cypher/internal/compiler/v3_0/executionplan/ExecutionPlanBuilder.scala @@ -19,8 +19,6 @@ */ package org.neo4j.cypher.internal.compiler.v3_0.executionplan -import java.util.function.Supplier - import org.neo4j.cypher.internal.compiler.v3_0.codegen.QueryExecutionTracer import org.neo4j.cypher.internal.compiler.v3_0.codegen.profiling.ProfilingTracer import org.neo4j.cypher.internal.compiler.v3_0.commands._ @@ -38,7 +36,6 @@ import org.neo4j.cypher.internal.compiler.v3_0.{ExecutionMode, ProfileMode, _} import org.neo4j.cypher.internal.frontend.v3_0.PeriodicCommitInOpenTransactionException import org.neo4j.cypher.internal.frontend.v3_0.ast.Statement import org.neo4j.cypher.internal.frontend.v3_0.notification.InternalNotification -import org.neo4j.function.Suppliers.singleton import org.neo4j.graphdb.GraphDatabaseService import org.neo4j.graphdb.QueryExecutionType.QueryType import org.neo4j.helpers.Clock @@ -232,12 +229,12 @@ class ExecutionPlanBuilder(graph: GraphDatabaseService, config: CypherCompilerCo } object ExecutionPlanBuilder { - type DescriptionProvider = (InternalPlanDescription => (Supplier[InternalPlanDescription], Option[QueryExecutionTracer])) + type DescriptionProvider = (InternalPlanDescription => (org.neo4j.function.Supplier[InternalPlanDescription], Option[QueryExecutionTracer])) def tracer( mode: ExecutionMode ) : DescriptionProvider = mode match { case ProfileMode => val tracer = new ProfilingTracer() - (description: InternalPlanDescription) => (new Supplier[InternalPlanDescription] { + (description: InternalPlanDescription) => (new org.neo4j.function.Supplier[InternalPlanDescription] { override def get(): InternalPlanDescription = description.map { plan: InternalPlanDescription => @@ -248,6 +245,8 @@ object ExecutionPlanBuilder { addArgument(Arguments.Time(data.time())) } }, Some(tracer)) - case _ => (description: InternalPlanDescription) => (singleton(description), None) + case _ => (description: InternalPlanDescription) => (new org.neo4j.function.Supplier[InternalPlanDescription] { + override def get(): InternalPlanDescription = description + }, None) } } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/GeneratedQueryStructure.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/GeneratedQueryStructure.scala index 6d9f1c050582f..b03c286efdc36 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/GeneratedQueryStructure.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/GeneratedQueryStructure.scala @@ -21,7 +21,6 @@ package org.neo4j.cypher.internal.spi.v2_3 import java.util -import java.util.function.Supplier import org.neo4j.codegen import org.neo4j.codegen.CodeGeneratorOption._ @@ -73,7 +72,7 @@ object GeneratedQueryStructure extends CodeStructure[GeneratedQuery] { ro = clazz.field(typeRef[ReadOperations], "ro"), nodeManager = clazz.field(typeRef[NodeManager], "nodeManager"), executionMode = clazz.field(typeRef[ExecutionMode], "executionMode"), - description = clazz.field(typeRef[Supplier[InternalPlanDescription]], "description"), + description = clazz.field(typeRef[org.neo4j.function.Supplier[InternalPlanDescription]], "description"), tracer = clazz.field(typeRef[QueryExecutionTracer], "tracer"), params = clazz.field(typeRef[util.Map[String, Object]], "params"), closeable = clazz.field(typeRef[SuccessfulCloseable], "closeable"), @@ -117,7 +116,7 @@ object GeneratedQueryStructure extends CodeStructure[GeneratedQuery] { param[Statement]("statement"), param[NodeManager]("nodeManager"), param[ExecutionMode]("executionMode"), - param[Supplier[InternalPlanDescription]]("description"), + param[org.neo4j.function.Supplier[InternalPlanDescription]]("description"), param[QueryExecutionTracer]("tracer"), param[util.Map[String, Object]]("params"))) { execute => execute.returns(Expression.invoke(Expression.newInstance(execution), MethodReference.constructorReference(execution, @@ -125,7 +124,7 @@ object GeneratedQueryStructure extends CodeStructure[GeneratedQuery] { typeRef[Statement], typeRef[NodeManager], typeRef[ExecutionMode], - typeRef[Supplier[InternalPlanDescription]], + typeRef[org.neo4j.function.Supplier[InternalPlanDescription]], typeRef[QueryExecutionTracer], typeRef[util.Map[String, Object]]), execute.load("closer"), @@ -849,13 +848,13 @@ private object Templates { param[Statement]("statement"), param[NodeManager]("nodeManager"), param[ExecutionMode]("executionMode"), - param[Supplier[InternalPlanDescription]]("description"), + param[org.neo4j.function.Supplier[InternalPlanDescription]]("description"), param[QueryExecutionTracer]("tracer"), param[util.Map[String, Object]]("params")). put(self(), typeRef[TaskCloser], "closer", load("closer")). put(self(), typeRef[ReadOperations], "ro", invoke(load("statement"), method[Statement, ReadOperations]("readOperations"))). put(self(), typeRef[ExecutionMode], "executionMode", load("executionMode")). - put(self(), typeRef[Supplier[InternalPlanDescription]], "description", load("description")). + put(self(), typeRef[org.neo4j.function.Supplier[InternalPlanDescription]], "description", load("description")). put(self(), typeRef[QueryExecutionTracer], "tracer", load("tracer")). put(self(), typeRef[util.Map[String, Object]], "params", load("params")). put(self(), typeRef[NodeManager], "nodeManager", load("nodeManager")). @@ -875,7 +874,7 @@ private object Templates { returns(get(self(), typeRef[ExecutionMode], "executionMode")). build() val EXECUTION_PLAN_DESCRIPTION = MethodTemplate.method(typeRef[InternalPlanDescription], "executionPlanDescription"). - returns(invoke(get(self(), typeRef[Supplier[InternalPlanDescription]], "description"), method[Supplier[InternalPlanDescription], InternalPlanDescription]("get"))). + returns(invoke(get(self(), typeRef[org.neo4j.function.Supplier[InternalPlanDescription]], "description"), method[org.neo4j.function.Supplier[InternalPlanDescription], InternalPlanDescription]("get"))). build() val JAVA_COLUMNS = MethodTemplate.method(typeRef[util.List[String]], "javaColumns"). returns(get(typeRef[util.List[String]], "COLUMNS")). diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_0/GeneratedQueryStructure.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_0/GeneratedQueryStructure.scala index dd2325fe84b3e..8ebd132c5954d 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_0/GeneratedQueryStructure.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_0/GeneratedQueryStructure.scala @@ -21,7 +21,6 @@ package org.neo4j.cypher.internal.spi.v3_0 import java.util -import java.util.function.Supplier import org.neo4j.codegen import org.neo4j.codegen.CodeGeneratorOption._ @@ -73,7 +72,7 @@ object GeneratedQueryStructure extends CodeStructure[GeneratedQuery] { ro = clazz.field(typeRef[ReadOperations], "ro"), nodeManager = clazz.field(typeRef[NodeManager], "nodeManager"), executionMode = clazz.field(typeRef[ExecutionMode], "executionMode"), - description = clazz.field(typeRef[Supplier[InternalPlanDescription]], "description"), + description = clazz.field(typeRef[org.neo4j.function.Supplier[InternalPlanDescription]], "description"), tracer = clazz.field(typeRef[QueryExecutionTracer], "tracer"), params = clazz.field(typeRef[util.Map[String, Object]], "params"), closeable = clazz.field(typeRef[SuccessfulCloseable], "closeable"), @@ -117,7 +116,7 @@ object GeneratedQueryStructure extends CodeStructure[GeneratedQuery] { param[Statement]("statement"), param[NodeManager]("nodeManager"), param[ExecutionMode]("executionMode"), - param[Supplier[InternalPlanDescription]]("description"), + param[org.neo4j.function.Supplier[InternalPlanDescription]]("description"), param[QueryExecutionTracer]("tracer"), param[util.Map[String, Object]]("params"))) { execute => execute.returns(Expression.invoke(Expression.newInstance(execution), MethodReference.constructorReference(execution, @@ -125,7 +124,7 @@ object GeneratedQueryStructure extends CodeStructure[GeneratedQuery] { typeRef[Statement], typeRef[NodeManager], typeRef[ExecutionMode], - typeRef[Supplier[InternalPlanDescription]], + typeRef[org.neo4j.function.Supplier[InternalPlanDescription]], typeRef[QueryExecutionTracer], typeRef[util.Map[String, Object]]), execute.load("closer"), @@ -849,13 +848,13 @@ private object Templates { param[Statement]("statement"), param[NodeManager]("nodeManager"), param[ExecutionMode]("executionMode"), - param[Supplier[InternalPlanDescription]]("description"), + param[org.neo4j.function.Supplier[InternalPlanDescription]]("description"), param[QueryExecutionTracer]("tracer"), param[util.Map[String, Object]]("params")). put(self(), typeRef[TaskCloser], "closer", load("closer")). put(self(), typeRef[ReadOperations], "ro", invoke(load("statement"), method[Statement, ReadOperations]("readOperations"))). put(self(), typeRef[ExecutionMode], "executionMode", load("executionMode")). - put(self(), typeRef[Supplier[InternalPlanDescription]], "description", load("description")). + put(self(), typeRef[org.neo4j.function.Supplier[InternalPlanDescription]], "description", load("description")). put(self(), typeRef[QueryExecutionTracer], "tracer", load("tracer")). put(self(), typeRef[util.Map[String, Object]], "params", load("params")). put(self(), typeRef[NodeManager], "nodeManager", load("nodeManager")). @@ -875,7 +874,7 @@ private object Templates { returns(get(self(), typeRef[ExecutionMode], "executionMode")). build() val EXECUTION_PLAN_DESCRIPTION = MethodTemplate.method(typeRef[InternalPlanDescription], "executionPlanDescription"). - returns(invoke(get(self(), typeRef[Supplier[InternalPlanDescription]], "description"), method[Supplier[InternalPlanDescription], InternalPlanDescription]("get"))). + returns(invoke(get(self(), typeRef[org.neo4j.function.Supplier[InternalPlanDescription]], "description"), method[org.neo4j.function.Supplier[InternalPlanDescription], InternalPlanDescription]("get"))). build() val JAVA_COLUMNS = MethodTemplate.method(typeRef[util.List[String]], "javaColumns"). returns(get(typeRef[util.List[String]], "COLUMNS")). diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CodeGenSugar.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CodeGenSugar.scala index 2a67460c512a5..155a96b526aa8 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CodeGenSugar.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CodeGenSugar.scala @@ -20,7 +20,6 @@ package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir import java.util.concurrent.atomic.AtomicInteger -import java.util.function.Supplier import org.mockito.Mockito._ import org.neo4j.cypher.internal.compiler.v3_0.codegen.{Namer, _} @@ -115,7 +114,7 @@ trait CodeGenSugar extends MockitoSugar { graphdb: GraphDatabaseService = null, nodeManager: NodeManager = null, executionMode: ExecutionMode = null, - supplier: Supplier[InternalPlanDescription] = null, + supplier: org.neo4j.function.Supplier[InternalPlanDescription] = null, queryExecutionTracer: QueryExecutionTracer = QueryExecutionTracer.NONE, params: Map[String, AnyRef] = Map.empty): InternalExecutionResult = { val generated = clazz.execute(taskCloser, statement, nodeManager, diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CompiledProfilingTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CompiledProfilingTest.scala index 7d6ff279ae1f8..ead01a0e7b0e3 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CompiledProfilingTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_0/codegen/ir/CompiledProfilingTest.scala @@ -19,8 +19,6 @@ */ package org.neo4j.cypher.internal.compiler.v3_0.codegen.ir -import java.util.function.Supplier - import org.mockito.Matchers._ import org.mockito.Mockito._ import org.neo4j.collection.primitive.PrimitiveLongIterator @@ -69,7 +67,7 @@ class CompiledProfilingTest extends CypherFunSuite with CodeGenSugar { } }) - val supplier = new Supplier[InternalPlanDescription] { + val supplier = new org.neo4j.function.Supplier[InternalPlanDescription] { override def get(): InternalPlanDescription = PlanDescriptionImpl(id2, "accept", SingleChild(PlanDescriptionImpl(id1, "scanallnodes", NoChildren, Seq.empty, Set.empty)), Seq.empty, Set.empty) } diff --git a/community/function/src/main/java/org/neo4j/function/Supplier.java b/community/function/src/main/java/org/neo4j/function/Supplier.java new file mode 100644 index 0000000000000..c102b235a2dcd --- /dev/null +++ b/community/function/src/main/java/org/neo4j/function/Supplier.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2002-2015 "Neo Technology," + * Network Engine for Objects in Lund AB [http://neotechnology.com] + * + * This file is part of Neo4j. + * + * Neo4j is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.neo4j.function; + +/** + * Please do not use this interface but use {@link java.util.function.Supplier} instead. + * The only reason for this interface to be here is because cypher-compiler-{2.3,3.0} needs it + * when generating compile runtimes. + */ +@Deprecated +public interface Supplier extends java.util.function.Supplier +{ +}