question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error running astminer

See original GitHub issue

Hello,

I downloaded JDK 14, gradle 6.3 on Windows 11 and succesfully built astminer at build/astminer/astminer.jar. I tried to run Python parser to generate code2vec paths but I got error:

$ ./cli.sh python.yaml Docker image not found, will use build/shadow/astminer.jar Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: astminer/Main Kt has been compiled by a more recent version of the Java Runtime (class file ve rsion 55.0), this version of the Java Runtime only recognizes class file version s up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

@SpirinEgor gave me Python .ymal file configuration:

# input directory (path to project)
inputDir: src/test/resources/
# output directory
outputDir: output

# parse Python files with ANTLR parser
parser:
  name: antlr
  languages: [py]

filters:
  - name: by tree size  # exclude the trees that have > 1000 nodes
    maxTreeSize: 1000

# use file names as labels
# this selects the file level granularity
label:
  name: function name

# extract from each tree paths with length 9 and width 2
# save paths in code2vec format
storage:
  name: code2vec
  maxPathLength: 9
  maxPathWidth: 2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:24 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
SpirinEgorcommented, Nov 1, 2021

44 rows mean 44 methods in python files under the passed inputDir path. It seems that you ran astminer on test data. You can traverse all .py files in /src/test/resources and count appear functions (all expressions started with def). There are exactly 44 functions.

Of course, the more files you provide the more lines in result files. I may advise you not to open such files with GUI editor. If you want to check a specific line, it’s better to use a combination of bash tools such as head and tail.

Also, since model training requires validation and test holdouts along with train data, astminer may create path contexts for each holdout based on the passed dataset. For this, split data in inputDir into three folders: train, val, and test. astminer will detect this and provide 3 path context files in the end.

Since your problem is solved, I close this issue. If you still have problems with running astminer don’t hesitate to reopen it. If you have any other problems or questions, feel free to open new issues.

0reactions
SpirinEgorcommented, Nov 7, 2021

This file contains python counters, and therefore it is not possible to save them from Kotlin. You can download preprocessed data, there are links in the readme file in the code2vec repository. It also contains this dict file so you can open it and see what is inside.

It’s better to open the issue in the code2vec repository and ask authors how to collect those counts. You should use train.c2s to collect them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Tool for Mining Rich Abstract Syntax Trees from Code - arXiv
To showcase this idea, we use our tool to infer types of identifiers in Java ASTs and extend the code2seq model for the...
Read more >
UNIVERSITY OF CALIFORNIA, IRVINE Code Clone Detection ...
code and detect one-by-one errors in Java code snippets. ... Then Code2Vec model is run on the methods extracted from tagged clone.
Read more >
A Tool for Mining Rich Abstract Syntax Trees from Code
In this work, we present PSIMiner - a tool for processing PSI trees from the IntelliJ Platform. PSI trees contain code syntax trees...
Read more >
Constraint-Aware Role Mining Via Extended Boolean Matrix ...
Abstract—The role mining problem has received considerable attention recently. Among the many solutions ... The second one is running the F astM iner....
Read more >
Report error when CLI compiler is not being run under Java 8+
Instead of getting an exception from the class loader, we can make the launcher script terminate with an error if the compiler is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found