micro-editor / micro-editor/micro
Micro places compiled Java programs into incorrect directory when auto-compiling
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 29.6k
- Forks
- 1.4k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 10
Description
Description of the problem or steps to reproduce
Upon saving any Java program that throws no compiler errors, Micro will automatically compile and save a .class file with the same name as the .java file that was saved. However, when certain .java programs are saved as part of a package, Micro will place the compiled file in the wrong directory.
To reproduce:
- Create a directory to serve as your project source. I'm using
~/Documents/JavaProjects/ProjectSource, but you can use anything, and I'll just refer to this assrcfrom now on. - Create a folder such as
src/MyPackage. - Navigate to
src/MyPackageand, using Micro, create a file such assrc/MyPackage/PackagedClass.java. The class should includepackage MyPackage;as the first line, and the contents can probably be anything, as long as the result is a valid Java class. Upon saving, notice that Micro has taken the liberty of creating a new directory,src/MyPackage/MyPackage, and within this new directory, the compiled.classfile can be found,src/MyPackage/MyPackage/PackagedClass.class. This is the crux of the issue. When correctly compiled, the resulting compiled class should be found in the same directory as the original.javafile. (The reason this is an issue is because a developer may wish to structure their.javafiles in accordance with their package structure, and so having Micro create the compiled.classfiles in the wrong directory creates hassle and confusion).
I've also been able to create situations where a .java file in the default package causes the same issue on a much larger scale. For example, I had a situation where I had a file in /home/[User]/Documents/JavaProjects/TestCore/Test.java that, when saved after being edited with Micro, created a class in /home/[User]/Documents/JavaProjects/TestCore/home/[User]/Documents/JavaProjects/TestCore/Test.class, and I have... no idea how or why this happens. I'm not able to consistently reproduce it, with some projects it happens and with some it doesn't
I apologize if I have made any errors in my explanation, and please let me know if there is anything I should clarify or change.
Specifications
Commit hash: 68d88b57
OS: Linux
Terminal: Konsole (KDE's Terminal Emulator)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reproducing the package and default-package cases when saving Java files, then trace Micro's auto-compilation path using commit 68d88b57. Done means compiled .class files are placed in the expected source directory without duplicated package or absolute path components.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, java
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100