acr31 / features-javac Goto Github PK
View Code? Open in Web Editor NEWA javac plugin for extracting a feature graph for plugging in to machine learning models
License: Apache License 2.0
A javac plugin for extracting a feature graph for plugging in to machine learning models
License: Apache License 2.0
It appears that the feature extractor plugin supports two options:
https://github.com/acr31/features-javac/blob/master/extractor/src/main/java/uk/ac/cam/acr31/features/javac/FeaturePlugin.java#L91-L95
What's the syntax to pass them to the plugin?
It would be good to document this in the readme.
javac -cp extractor/target/features-javac-extractor-1.0.0-SNAPSHOT-jar-with-dependencies.jar -Xplugin:FeaturePlugin
QueueDrainObserver.java:2: 错误: 找不到符号
protected final void fastPathOrderedEmit(U value, boolean delayError, Disposable disposable) {
^
符号: 类 U
位置: 类 QueueDrainObserver
QueueDrainObserver.java:2: 错误: 找不到符号
protected final void fastPathOrderedEmit(U value, boolean delayError, Disposable disposable) {
^
符号: 类 Disposable
位置: 类 QueueDrainObserver
QueueDrainObserver.java:3: 错误: 找不到符号
final Observer<? super V> observer = downstream;
^
符号: 类 Observer
位置: 类 QueueDrainObserver
QueueDrainObserver.java:3: 错误: 找不到符号
final Observer<? super V> observer = downstream;
^
符号: 类 V
位置: 类 QueueDrainObserver
QueueDrainObserver.java:3: 错误: 找不到符号
final Observer<? super V> observer = downstream;
^
符号: 变量 downstream
位置: 类 QueueDrainObserver
QueueDrainObserver.java:4: 错误: 找不到符号
final SimplePlainQueue q = queue;
^
符号: 类 SimplePlainQueue
位置: 类 QueueDrainObserver
QueueDrainObserver.java:4: 错误: 找不到符号
final SimplePlainQueue q = queue;
^
符号: 类 U
位置: 类 QueueDrainObserver
QueueDrainObserver.java:4: 错误: 找不到符号
final SimplePlainQueue q = queue;
^
符号: 变量 queue
位置: 类 QueueDrainObserver
QueueDrainObserver.java:6: 错误: 找不到符号
if (wip.get() == 0 && wip.compareAndSet(0, 1)) {
^
符号: 变量 wip
位置: 类 QueueDrainObserver
QueueDrainObserver.java:6: 错误: 找不到符号
if (wip.get() == 0 && wip.compareAndSet(0, 1)) {
^
符号: 变量 wip
位置: 类 QueueDrainObserver
QueueDrainObserver.java:9: 错误: 找不到符号
if (leave(-1) == 0) {
^
符号: 方法 leave(int)
位置: 类 QueueDrainObserver
QueueDrainObserver.java:17: 错误: 找不到符号
if (!enter()) {
^
符号: 方法 enter()
位置: 类 QueueDrainObserver
QueueDrainObserver.java:21: 错误: 找不到符号
QueueDrainHelper.drainLoop(q, observer, delayError, disposable, this);
^
符号: 变量 QueueDrainHelper
位置: 类 QueueDrainObserver
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/D:/code/paper_impl_and_git_code/myself/pyBKT/hey/ast_deal/features-javac/extractor/target/features-javac-extractor-1.0.0-SNAPSHOT-jar-with-dependencies.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Feature extraction failed: QueueDrainObserver.java
May I be able to extract such a Java file with only a class name and one method, while not importing any packages, but the method references a certain class.
Possibly related to #10
log.txt contains a list of about 300 occurrences of this bug in the current ML4PL corpus.
Run feature extractor on the metrics project and inspect graph corresponding to DerivativeGaugeTest.java.
Currently node 293 is associated with SYMBOL_TYP(com.codahale.metrics.DerivativeGaugeTest$1)
This should instead be the appropriate SYMBOL_MTH.
When an annotation proceeds a method javadoc, the javadoc is not attached to the method but to the next token instead.
public class Test {
@Deprecated
/**
* Method Javadoc
* @param s variable desc
*/
Test(String s) {}
}
I would expect the JavaDoc to be attached to the method as in the following code
public class Test {
/**
* Method Javadoc
* @param s variable desc
*/
@Deprecated
Test(String s) {
}
}
Tried mvn test
.
Environment: Ubuntu 18.04; OpenJDK 10.0.2
Expected Outcome: Things work.
Actual Outcome:
Running uk.ac.cam.acr31.features.javac.SymbolScannerTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.379 sec
Running uk.ac.cam.acr31.features.javac.FeaturePluginTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.559 sec
Running uk.ac.cam.acr31.features.javac.ComputedFromTest
Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.603 sec <<< FAILURE!
computedFrom_excludesAnonymousParameters(uk.ac.cam.acr31.features.javac.ComputedFromTest) Time elapsed: 0.193 sec <<< ERROR!
java.lang.NullPointerException
at uk.ac.cam.acr31.features.javac.graph.FeatureGraph.toIdentifierNode(FeatureGraph.java:187)
at uk.ac.cam.acr31.features.javac.syntactic.SymbolScanner.addNode(SymbolScanner.java:104)
at uk.ac.cam.acr31.features.javac.syntactic.SymbolScanner.visitVariable(SymbolScanner.java:88)
at uk.ac.cam.acr31.features.javac.syntactic.SymbolScanner.visitVariable(SymbolScanner.java:37)
[...]
.dot file could not be generated
oldLocale
usage inside Locale.setDefault
method call is incorrectly mapped to have SYMBOL_MTH parent.oldLocale
should be attached to SYMBOL_VAR similar to it's definition:
Thank you very much for providing the code. I am having trouble using your code on a raw dataset from [https://github.com/xing-hu/DeepCom]. I am providing more details below:
The code snippet from the dataset is always a method or function and an example is shown below:
public static String unEscapeString(String str,char escapeChar,char charToEscape){ return unEscapeString(str,escapeChar,new char[]{charToEscape});}
When I ran javac -cp extractor/target/features-javac-extractor-1.0.0-SNAPSHOT-jar-with-dependencies.jar -Xplugin:FeaturePlugin test.java
,
the program throws the errors:
test.java:1: Error: need class, interface or enum public static String unEscapeString(String str,char escapeChar,char charToEscape){ return unEscapeString(str,escapeChar,new char[]{charToEscape});}
test.java:1: Error: need class, interface or enum public static String unEscapeString(String str,char escapeChar,char charToEscape){ return unEscapeString(str,escapeChar,new char[]{charToEscape});}
Would you mind providing some insights on how to adjust the data or source code? Thanks!
Hi,
Thanks for the tool.
I may find a bug in generating proto files.
The following command works fine.
javac -cp extractor/target/features-javac-extractor-1.0.0-SNAPSHOT-jar-with-dependencies.jar -Xplugin:FeaturePlugin T.java
However, the following command can't generate the prote file.
javac -cp extractor/target/features-javac-extractor-1.0.0-SNAPSHOT-jar-with-dependencies.jar -Xplugin:FeaturePlugin /proj/fff000/modelAbil/features-javac/T.java
This is interesting that my working directory is /proj/fff000/modelAbil/features-javac
.
My jdk version is javac 11.0.2
May I ask is it mean
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.