Comments (3)
Hi, i haven't documented it yet. But i wrote an extension method MessageCollector.printMessage(diagnosticKind: DiagnosticKind, message: String)
(in https://github.com/Foso/MpApt/blob/master/mpapt-runtime/src/main/java/de/jensklingenberg/mpapt/utils/KaptUtils.kt)
to try to provide a similar api to the java annotation processor.
You can get the MessageCollector from the configuration like this:
val messager = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY,MessageCollector.NONE)
messager.printMessage(DiagnosticKind.ERROR,"My error message")
I will add it to the documentation
from mpapt.
👍 any plan to add an argument to pass the element the warning/error happened on?
from mpapt.
I hadn't considered this before, but i took a quick look how can be done with compiler api. I changed the printMessage() and added the CompilerMessageLocation as a parameter.
Inside your processor, you can use it like that:
configuration.messager().printMessage(DiagnosticKind.ERROR,"My error message", CompilerMessageLocation.Companion.create("/home/jens/Code/2019/MpApt/kotlin-plugin-shared/src/main/java/de/jensklingenberg/MpAptTestProcessor.kt",42,106))
This will print the message to the log and stop the compiler:
e: /home/jens/Code/2019/MpApt/kotlin-plugin-shared/src/main/java/de/jensklingenberg/MpAptTestProcessor.kt: (42, 106): My error message
I can't add an element parameter yet, because my element type doesn't have the (line,column)-Information. But i think it could be possible to get information out of a "descriptor"
from mpapt.
Related Issues (14)
- [Question/Help Wanted] Annotation Processor get's called to late in the process? HOT 8
- [Question/Help wanted] Resolving dependencies between the different Gradle modules HOT 2
- ComponentRegistrar is not being called HOT 5
- [Question/Help Wanted] Running apt in the same sourceset while compiling it HOT 4
- Expression annotations are only detected on function declarations- HOT 1
- Help wanted HOT 2
- Help Wanted: Only one Expression Annotation is detected HOT 1
- KotlinGradleSubplugin is deprecated in 1.4.0 HOT 2
- GradlePlugin -> KotlinCompilerPlugin fails HOT 1
- I will the change the checking for supported target platforms
- Compilation faillure on classes without properties HOT 1
- Just discovered the DeclarationChecker Class
- Problem guessing build folder when deploying to Heroku HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mpapt.