Loading Annotation Processor with Enable Preview

Answered

Hello,

I'm trying to use JDK 14 with the record builder. When I try to build the project, I get the following message:

Error:java: Could not load processor class file due to 'Preview features are not enabled for io/soabase/recordbuilder/processor/RecordBuilderProcessor (class file version 58.65535). Try running with '--enable-preview''.

My project is imported as a Gradle project. When I run build and tests with the CMD, everything works as expected. Moreover, when I set up:

Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle -> Build and run using: Gradle

it also worked. However, this solution is not suitable for me. I would like IJ to run all the builds when working with IDE.

How can I mark that I would like to load the annotation processor with the --enable-preview flag?

I have tried:

  1. Help -> Custom VM Options
  2. Preferences -> Compiler -> Annotation Processors -> Annotation processor options
  3. Setting language level in modules
  4. Setting the --enable-preview  flag in Gradle

 

0
10 comments

Could not reproduce that for Gradle project in IntelliJ IDEA 2020.1.1.

What is your IntelliJ IDEA version? 

Have you accepted the preview features alert when changed language level https://i.imgur.com/qljXAUF.png? 

Don't you see the notification in the event log https://i.imgur.com/NZbhDAk.png? 

0
Avatar
Permanently deleted user

I use

IntelliJ IDEA 2020.1.1 (Ultimate Edition)
Build #IU-201.7223.91, built on April 30, 2020

Gradle 6.3

macOS Mojave 10.14.6

I don't see any of the notifications that you showed. 

 

UPDATE:

In the workspace.xml I found the following line:

<property name="ignore.preview.features.used" value="true" />

I changed its value to false and in the Event Log I can see:

13:17	Java Preview Features (Newer IDE versions may discontinue support for preview features)
When Java 15 would be released, support for 14 (Preview) language level may be dropped
Do Not Show Again

 

0

Try to set 14(Preview) language level in project's settings: 

https://i.imgur.com/GxcoyLv.png

 

0
Avatar
Permanently deleted user

It is done already. This was the very first thing that I did.

0

could you please share the project you are working on or create a minimal reproducible example?

0
Avatar
Permanently deleted user

Ok, I have created a reproducible example. On my machine, building the project with the hammer icon fails with the following message:

Error:java: Could not load processor class file due to 'Preview features are not enabled for io/soabase/recordbuilder/processor/RecordBuilderProcessor (class file version 58.65535). Try running with '--enable-preview''.

I didn't see any of the notifications related to experimental features when I was importing the sources.

0

Project build fine in my case: https://i.imgur.com/kgomNws.png

Try removing `.idea` folder in the project's root and re-import the project from build.gradle file. 

0
Avatar
Permanently deleted user

Did you change

Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle -> Build and run using: IntelliJ

?

By default, Gradle is selected.

I created the project with spring.start.io and then imported it with Project from existing sources.

0

Yes, of course: https://i.imgur.com/N675wS8.png

Try restore default settings (File | Manage IDE Settings | Restore Default Settings) and disable custom plugins

 

0
Avatar
Permanently deleted user

After restoring to default settings, all the custom plugins have been erased.

Looks like it hasn't helped - https://imgur.com/a/dF1iuRw

0

Please sign in to leave a comment.