Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"has weaker access privileges; it should be public" error when compiling against jOOQ #18654

Closed
tpunder opened this issue Oct 5, 2023 · 7 comments · Fixed by #18953
Closed

Comments

@tpunder
Copy link

tpunder commented Oct 5, 2023

Compiler version

Scala 3.3.1

Minimized code

See: https://github.com/tpunder/scala3_jooq_bug_access_privileges

The only Scala source file is:

package com.example

import org.jooq.impl.AbstractRoutine

// Works in Scala 2.12 and 2.13 but is broken in Scala 3
class MyRoutineScala extends AbstractRoutine[String] {

}

The equivalent Java source compiles file:

package com.example;

import org.jooq.impl.AbstractRoutine;

// Works fine
class MyRoutineJava extends AbstractRoutine<String> {

}

Output

[info] Setting Scala version to 3.3.1 on 1 projects.
[info] Reapplying settings...
[info] set current project to scala3_jooq_bug_access_privileges (in build file:/Users/tim/code/personal/scala3_jooq_bug_access_privileges/)
[info] compiling 1 Scala source and 6 Java sources to /Users/tim/code/personal/scala3_jooq_bug_access_privileges/target/scala-3.3.1/classes ...
[error] -- [E164] Declaration Error: /Users/tim/code/personal/scala3_jooq_bug_access_privileges/src/main/scala/com/example/MyRoutineScala.scala:6:6
[error] 6 |class MyRoutineScala extends AbstractRoutine[String] {
[error]   |      ^
[error]   |error overriding method configuration in trait Attachable of type (): org.jooq.Configuration;
[error]   |  method configuration in class AbstractQueryPart of type (): org.jooq.Configuration has weaker access privileges; it should be public
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 2 s, completed Oct 5, 2023, 2:11:58 PM

Expectation

The code works fine under Scala 2.12 and 2.13:

[info] Setting Scala version to 2.12.18 on 1 projects.
[info] Reapplying settings...
[info] set current project to scala3_jooq_bug_access_privileges (in build file:/Users/tim/code/personal/scala3_jooq_bug_access_privileges/)
[info] compiling 1 Scala source to /Users/tim/code/personal/scala3_jooq_bug_access_privileges/target/scala-2.12/classes ...
[success] Total time: 1 s, completed Oct 5, 2023, 2:11:55 PM
[info] Setting Scala version to 2.13.10 on 1 projects.
[info] Reapplying settings...
[info] set current project to scala3_jooq_bug_access_privileges (in build file:/Users/tim/code/personal/scala3_jooq_bug_access_privileges/)
[info] compiling 1 Scala source to /Users/tim/code/personal/scala3_jooq_bug_access_privileges/target/scala-2.13/classes ...
[success] Total time: 1 s, completed Oct 5, 2023, 2:11:56 PM

There is a similar jOOQ related bug here: #16844

@tpunder tpunder added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 5, 2023
@tpunder
Copy link
Author

tpunder commented Oct 12, 2023

There is any additional information I can provide for this bug?

@som-snytt
Copy link
Contributor

Worth adding that the linked project is minimized; it supplies the minimal required Java classes. I spent some time a week ago to try it out, and I was like where is the jooq dependency? I didn't come to any conclusion about the override check, IIRC.

@odersky odersky self-assigned this Oct 13, 2023
@bishabosha bishabosha added area:refchecks and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 13, 2023
@SethTisue
Copy link
Member

SethTisue commented Oct 13, 2023

note that #16844 is also now minimized/no-dependencies. it isn't obvious to me whether they're related.

@odersky
Copy link
Contributor

odersky commented Nov 16, 2023

There are dependencies to jooq both here and in #16844.

I agree that this needs fixing at high priority but as a matter of general policy I will not handle bugs with external dependencies. My time is extremely limited and my setup makes it very hard to add such dependencies since I do everything outside of a build tool with an explicit class path.

So somebody has to either minimize it so that it becomes self-contained or take this on themselves (I can provide advice where to look).

@odersky odersky removed their assignment Nov 16, 2023
@som-snytt
Copy link
Contributor

My previous comment meant that the linked project has "outline" API in jooq packaging, such as https://github.com/tpunder/scala3_jooq_bug_access_privileges/blob/main/src/main/java/org/jooq/Configuration.java

I don't think that is the best way to present a minimization, and there are several interfaces involved, but it is not compiled against actual jooq. No joke! I mean, no jooq!

@odersky
Copy link
Contributor

odersky commented Nov 16, 2023

Ah I see now. @EugeneFlesselle is trying to reproduce it with the minimized project now. Once we have that we'll see whether we can do something about it.

@odersky odersky assigned eed3si9n and odersky and unassigned eed3si9n Nov 16, 2023
@odersky
Copy link
Contributor

odersky commented Nov 16, 2023

Looks like we found a fix. PR is forthcoming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants