Closed EotT123 closed 7 months ago
...building with IntelliJ or Maven just resulted in compilation failure
One thing to check. Does your dbconfig file have either buildUrl
or url
assigned?
Did you run maven with -e
? Is there any chance I can access or your project or perhaps you could share or send it confidentially to me? Chances are I'll diagnose the issue quickly. Thanks.
I investigate it myself, and found the issue.
The issue is caused by tabled names which are using reserved keywords (or probably also why special characters, like whitespaces). Those are not correctly handled by manifold.
org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (near "order": syntax error)
at org.sqlite.core.DB.newSQLException(DB.java:1179)
at org.sqlite.core.DB.newSQLException(DB.java:1190)
at org.sqlite.core.DB.throwex(DB.java:1150)
at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
at org.sqlite.core.NativeDB.prepare(NativeDB.java:132)
at org.sqlite.core.DB.prepare(DB.java:264)
at org.sqlite.core.CorePreparedStatement.<init>(CorePreparedStatement.java:46)
at org.sqlite.jdbc3.JDBC3PreparedStatement.<init>(JDBC3PreparedStatement.java:32)
at org.sqlite.jdbc4.JDBC4PreparedStatement.<init>(JDBC4PreparedStatement.java:25)
at org.sqlite.jdbc4.JDBC4Connection.prepareStatement(JDBC4Connection.java:34)
at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:225)
at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:205)
at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:337)
at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
at manifold.sql.schema.jdbc.JdbcSchemaTable.getColumnClassNames(JdbcSchemaTable.java:164)
at manifold.sql.schema.jdbc.JdbcSchemaTable.<init>(JdbcSchemaTable.java:114)
at manifold.sql.schema.jdbc.JdbcSchema.build(JdbcSchema.java:99)
at manifold.sql.schema.jdbc.JdbcSchema.<init>(JdbcSchema.java:76)
at manifold.sql.schema.jdbc.JdbcSchemaProvider.getSchema(JdbcSchemaProvider.java:30)
at manifold.sql.schema.type.SchemaModel.loadSchema(SchemaModel.java:99)
at manifold.sql.schema.type.SchemaModel.init(SchemaModel.java:74)
at manifold.sql.schema.type.SchemaModel.<init>(SchemaModel.java:62)
at manifold.sql.schema.type.SchemaManifold.lambda$init$0(SchemaManifold.java:48)
at manifold.api.type.ResourceFileTypeManifold.lambda$buildFqnToModelCache$0(ResourceFileTypeManifold.java:108)
at manifold.util.concurrent.LocklessLazyVar$1.init(LocklessLazyVar.java:92)
at manifold.util.concurrent.LocklessLazyVar.get(LocklessLazyVar.java:41)
at manifold.api.type.ResourceFileTypeManifold.getModel(ResourceFileTypeManifold.java:265)
at manifold.sql.schema.type.SchemaManifold.getModel(SchemaManifold.java:101)
at manifold.sql.query.type.SqlScope.addIssuesFromSchemaModel(SqlScope.java:71)
at manifold.sql.query.type.SqlScope.findSchema(SqlScope.java:59)
at manifold.sql.query.type.SqlScope.getSchema(SqlScope.java:113)
at manifold.sql.query.type.SqlScope.getDbconfig(SqlScope.java:104)
at manifold.sql.query.type.SqlScopeFinder.lambda$validateZeroOrOneDefaultScopes$2(SqlScopeFinder.java:103)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1715)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at manifold.sql.query.type.SqlScopeFinder.validateZeroOrOneDefaultScopes(SqlScopeFinder.java:105)
at manifold.sql.query.type.SqlScopeFinder.validate(SqlScopeFinder.java:97)
at manifold.sql.query.type.SqlScopeFinder.findScopes(SqlScopeFinder.java:91)
at manifold.sql.query.type.SqlScopeFinder.findScope(SqlScopeFinder.java:43)
at manifold.sql.query.type.SqlModel.assignScope(SqlModel.java:115)
at manifold.sql.query.type.SqlModel.init(SqlModel.java:65)
at manifold.sql.query.type.SqlModel.<init>(SqlModel.java:59)
at manifold.sql.query.type.SqlManifold.lambda$init$0(SqlManifold.java:40)
at manifold.api.type.ResourceFileTypeManifold.lambda$buildFqnToModelCache$0(ResourceFileTypeManifold.java:108)
at manifold.util.concurrent.LocklessLazyVar$1.init(LocklessLazyVar.java:92)
at manifold.util.concurrent.LocklessLazyVar.get(LocklessLazyVar.java:41)
at manifold.api.type.ResourceFileTypeManifold.getModel(ResourceFileTypeManifold.java:265)
at manifold.sql.query.type.SqlManifold.getModel(SqlManifold.java:108)
at manifold.sql.query.type.SqlManifold.getModel(SqlManifold.java:30)
at manifold.api.type.ResourceFileTypeManifold$CacheClearer.createdType(ResourceFileTypeManifold.java:586)
at manifold.api.type.ResourceFileTypeManifold$CacheClearer.refreshedTypes(ResourceFileTypeManifold.java:550)
at manifold.internal.host.TypeRefreshListener.notifyNonearlyListeners(TypeRefreshListener.java:153)
at manifold.internal.host.TypeRefreshListener.notify(TypeRefreshListener.java:136)
at manifold.internal.host.TypeRefreshListener.created(TypeRefreshListener.java:119)
at manifold.internal.host.SingleModuleManifoldHost.createdType(SingleModuleManifoldHost.java:91)
at manifold.internal.javac.JavacPlugin$FileFragmentResource.inline(JavacPlugin.java:1501)
at manifold.internal.javac.JavacPlugin$FileFragmentResource.access$100(JavacPlugin.java:1440)
at manifold.internal.javac.JavacPlugin.addFileFragments(JavacPlugin.java:1424)
at manifold.internal.javac.JavacPlugin.started(JavacPlugin.java:1111)
at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.started(ClientCodeWrapper.java:865)
at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.started(MultiTaskListener.java:120)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1068)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:947)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)
Which is caused by this table definition:
CREATE TABLE IF NOT EXISTS "order" (
order_id INTEGER PRIMARY KEY autoincrement NOT NULL,
bill_id INTEGER NOT NULL,
tista TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
FOREIGN KEY(bill_id) REFERENCES bill(bill_id)
);
To fix this, the following change is needed:
On line 164 of JdbcSchemaTable.java, the table name should be quoted:
"select * from " + _name
should become "select * from " + DbUtil.enquoteIdentifier( _name , metaData )
There are other places where this should be changed too, e.g. all code responsible for creating queries for fetch(...) methods.
The reason why this exception was not visible using maven/javac (even with -e
), is because it is catched here, but the code goes on, suppressing(?) this exception.
Everything get compiled now, but I'm still receiving an exception later on (I still need to investigate that one, but that will be something for tomorrow. Unless you immediately have an idea what the reason could be.):
java.lang.AssertionError: isSameType DEFERRED
at jdk.compiler/com.sun.tools.javac.code.Types$5.visitType(Types.java:1379)
at jdk.compiler/com.sun.tools.javac.code.Types$5.visitType(Types.java:1351)
at jdk.compiler/com.sun.tools.javac.code.Type.accept(Type.java:223)
at jdk.compiler/com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4894)
at jdk.compiler/com.sun.tools.javac.code.Types$5.visitMethodType(Types.java:1443)
at jdk.compiler/com.sun.tools.javac.code.Types$5.visitMethodType(Types.java:1351)
at jdk.compiler/com.sun.tools.javac.code.Type$MethodType.accept(Type.java:1495)
at jdk.compiler/com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4894)
at jdk.compiler/com.sun.tools.javac.code.Types.isSameType(Types.java:1343)
at manifold.internal.javac.ManTypes_17.isSameMethodSym(ManTypes_17.java:208)
at manifold.internal.javac.ManTypes_17.memberType(ManTypes_17.java:184)
at jdk.compiler/com.sun.tools.javac.comp.Check.checkOverride(Check.java:1850)
at jdk.compiler/com.sun.tools.javac.comp.Check.checkImplementations(Check.java:2560)
at jdk.compiler/com.sun.tools.javac.comp.Attr.setFunctionalInfo(Attr.java:3949)
at jdk.compiler/com.sun.tools.javac.comp.Attr.lambda$setFunctionalInfo$32(Attr.java:3932)
at jdk.compiler/com.sun.tools.javac.comp.InferenceContext.notifyChange(InferenceContext.java:264)
at jdk.compiler/com.sun.tools.javac.comp.InferenceContext.notifyChange(InferenceContext.java:255)
at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:222)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:618)
at jdk.compiler/com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:657)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:4949)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:4741)
at jdk.compiler/com.sun.tools.javac.comp.AttrRecover.basicMethodInvocationRecovery(AttrRecover.java:224)
at jdk.compiler/com.sun.tools.javac.comp.AttrRecover.recoverMethodInvocation(AttrRecover.java:214)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:4644)
at jdk.compiler/com.sun.tools.javac.comp.Attr.checkId(Attr.java:4634)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:4527)
at manifold.internal.javac.ManAttr_17.visitSelect(ManAttr_17.java:144)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2581)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2617)
at manifold.internal.javac.ManAttr_17.visitApply(ManAttr_17.java:573)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1816)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:4400)
at manifold.internal.javac.ManAttr_17.visitSelect(ManAttr_17.java:144)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2581)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2617)
at manifold.internal.javac.ManAttr_17.visitApply(ManAttr_17.java:573)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1816)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:708)
at manifold.internal.javac.ManAttr_17.attribExpr(ManAttr_17.java:875)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:1305)
at manifold.internal.javac.ManAttr_17.visitVarDef(ManAttr_17.java:273)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:1022)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:755)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1439)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1092)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1229)
at manifold.internal.javac.ManAttr_17.visitMethodDef(ManAttr_17.java:215)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:916)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5655)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5543)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5367)
at manifold.internal.javac.ManAttr_17.attribClass(ManAttr_17.java:1181)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5306)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1359)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:976)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)
I've created a PR for escaping table names: https://github.com/manifold-systems/manifold/pull/559 I'm not sure if I've converted all cases as I'm still new to the code, but at first sight, it seems to be working.
Compiling a database with escaped table or column names doesn't fail anymore, and the generated code escapes now the table and column names correctly:
Excellent! I'm can't look at details right now, but thanks for looking into this and fixing it. Do you still see the subsequent stack trace with "java.lang.AssertionError: isSameType DEFERRED"? I'll probably get back to this later this evening.
Yes, java.lang.AssertionError: isSameType DEFERRED
is still present.
No problem, I'll fix this later tonight. There will be a new release with these changes by EOD Sunday.
I still get the java.lang.AssertionError: isSameType DEFERRED
exception, but on a different location:
java.lang.AssertionError: isSameType DEFERRED
at jdk.compiler/com.sun.tools.javac.code.Types$5.visitType(Types.java:1379)
at jdk.compiler/com.sun.tools.javac.code.Types$5.visitType(Types.java:1351)
at jdk.compiler/com.sun.tools.javac.code.Type.accept(Type.java:223)
at jdk.compiler/com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4894)
at jdk.compiler/com.sun.tools.javac.code.Types.isSameType(Types.java:1343)
at jdk.compiler/com.sun.tools.javac.comp.Attr.lambda$condType$10(Attr.java:2161)
at java.base/java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
at java.base/java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1950)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.allMatch(ReferencePipeline.java:637)
at jdk.compiler/com.sun.tools.javac.comp.Attr.condType(Attr.java:2161)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at manifold.util.ReflectUtil$LiveMethodRef.invoke(ReflectUtil.java:1001)
at manifold.internal.javac.ManAttr_17.lub(ManAttr_17.java:493)
at manifold.internal.javac.ManAttr_17.reassignAutoMethodReturnTypeToInferredType(ManAttr_17.java:452)
at manifold.internal.javac.ManAttr_17.visitReturn(ManAttr_17.java:413)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1728)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:755)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1439)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1092)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1229)
at manifold.internal.javac.ManAttr_17.visitMethodDef(ManAttr_17.java:215)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:916)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5655)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5543)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5367)
at manifold.internal.javac.ManAttr_17.attribClass(ManAttr_17.java:1181)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5306)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1359)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:976)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)
I can work around this one too, however I'd like to reproduce this if possible. Can you provide context for this stack trace? Seeing the code in your project that is causing this would help a lot. It appears to involve a method returning auto
, if that helps.
Thanks for pointing me in the right direction.
I'm using the exact same thing as described here. A method returning a tuple as an auto
, which is assigned to a var
.
Replacing it with a Pair
instead of a tuple fixes the problem, so I'm sure I'm looking in the right direction. I'll try to narrow it down, and report back. If possible, I'll try to create a small sample project which triggers this.
Does the change in 2024.1.10 fix that problem? Did this use of auto work before 2024.1.6?
edit:
Btw, I'm asking these specific questions because there are tests that cover auto
with tuples as multiple return values; there must be some combination/nesting of feature use in your project. If 2024.1.10 does not fix this, I suspect it may be a consequence of changes that went into 2024.1.6 and I'm considering backing these and related changes out to 2024.1.5. Anyhow, it would help quite a lot if I could reproduce this locally. So thanks for your efforts.
I'm sorry for the delay, I didn't had time to investigate it sooner.
The good news: 2024.1.10 fixes the problem. I've created a small sample project which triggers the problem. Changing the manifold version in the pom to 2024.1.10 allows you to compile it without issues.
I'm not sure what is causing the problem (maybe a combination of sql and tuples?). I hope this is what you need to investigate it further.
Hey this is great! I’ll check it out asap. Thanks!!
Ok, the fix that went into 2024.1.10 does indeed fix this issue. Thanks for the test, was a great help!
I have a manifold project using SQL (and others, like extensions, properties etc), and I receive the following error when compiling with javac (I had to use javac, because building with IntelliJ or Maven just resulted in
compilation failure
without extra info or stacktrace):As there is not much useful info (at least not for me), I have no idea what could be wrong. I've tried to disable/remove large parts of my project, but so far, I've been unable to narrow it down to what is causing this. Do you have any idea what could be causing this? Or is there any way how I can debug the compilation process?
I'm using manifold 2024.1.9
(I'm sorry for yet another ticket :flushed: )