New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code editor wrongly detects errors for libraries in code folder #3732

Closed
colouredmirrorball opened this Issue Aug 27, 2015 · 13 comments

Comments

Projects
None yet
4 participants
@colouredmirrorball

colouredmirrorball commented Aug 27, 2015

When a .jar file is inside the code folder, classes and methods from the jar used in the sketch will be displayed as an error (nonexisting functions/classes) even though the code compiles and runs just fine.

(Processing 3.0b5)

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 27, 2015

Member

Sounds like the code folder isn't being added to the error checker. Surprised this hasn't been found earlier. Thanks for the report.

Member

benfry commented Aug 27, 2015

Sounds like the code folder isn't being added to the error checker. Surprised this hasn't been found earlier. Thanks for the report.

@Manindra29

This comment has been minimized.

Show comment
Hide comment
@Manindra29

Manindra29 Aug 28, 2015

Member

Code folder is added to the error checker classpath. I'm not sure if it broke recently. Will it be possible to for you to share your sketch and the jar that would help reproduce the issue? (a small working sample of the sketch should suffice).

Member

Manindra29 commented Aug 28, 2015

Code folder is added to the error checker classpath. I'm not sure if it broke recently. Will it be possible to for you to share your sketch and the jar that would help reproduce the issue? (a small working sample of the sketch should suffice).

@colouredmirrorball

This comment has been minimized.

Show comment
Hide comment
@colouredmirrorball

colouredmirrorball Aug 28, 2015

I was using this library: http://www.jibble.org/pircbot.php, it provides a way to connect to an IRC server as a bot. This is how the code editor looks like (just a Processing adaptation of the example provided on the library's website):

schermafdruk 2015-08-28 14 06 29

The code compiles and runs without errors. The pircbot.jar file was added to the sketch by dragging and dropping it into the program.

I haven't tested it with other jars but it occurred with version 3.0b3 as well.

colouredmirrorball commented Aug 28, 2015

I was using this library: http://www.jibble.org/pircbot.php, it provides a way to connect to an IRC server as a bot. This is how the code editor looks like (just a Processing adaptation of the example provided on the library's website):

schermafdruk 2015-08-28 14 06 29

The code compiles and runs without errors. The pircbot.jar file was added to the sketch by dragging and dropping it into the program.

I haven't tested it with other jars but it occurred with version 3.0b3 as well.

@colouredmirrorball

This comment has been minimized.

Show comment
Hide comment
@colouredmirrorball

colouredmirrorball Aug 28, 2015

The errors disappeared when adding the statement import org.jibble.pircbot.*; to the beginning of the sketch.

colouredmirrorball commented Aug 28, 2015

The errors disappeared when adding the statement import org.jibble.pircbot.*; to the beginning of the sketch.

@timpulver

This comment has been minimized.

Show comment
Hide comment
@timpulver

timpulver Sep 1, 2015

@colouredmirrorball Thanks for the tip. Had the same problem with org.apache.commons.io.FilenameUtils – using org.apache.commons.io.* passes the syntax-check.

timpulver commented Sep 1, 2015

@colouredmirrorball Thanks for the tip. Had the same problem with org.apache.commons.io.FilenameUtils – using org.apache.commons.io.* passes the syntax-check.

@Manindra29 Manindra29 self-assigned this Sep 3, 2015

@Manindra29

This comment has been minimized.

Show comment
Hide comment
@Manindra29

Manindra29 Sep 8, 2015

Member

I believe the expected behaviour here is that even after adding the jar to the code folder, the import statement is required so that the compiler can know the package in which a class is located.

Member

Manindra29 commented Sep 8, 2015

I believe the expected behaviour here is that even after adding the jar to the code folder, the import statement is required so that the compiler can know the package in which a class is located.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 8, 2015

Member

No, that's not correct—putting something in the code folder will automatically add its imports.

Member

benfry commented Sep 8, 2015

No, that's not correct—putting something in the code folder will automatically add its imports.

@colouredmirrorball

This comment has been minimized.

Show comment
Hide comment
@colouredmirrorball

colouredmirrorball Sep 8, 2015

But not to the sketch code which is why the live code checker gives errors

colouredmirrorball commented Sep 8, 2015

But not to the sketch code which is why the live code checker gives errors

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 8, 2015

Member

I was responding to @Manindra29. The correct behavior is that the error checker should be automatically adding the imports. His error checking code is doing the wrong thing.

Member

benfry commented Sep 8, 2015

I was responding to @Manindra29. The correct behavior is that the error checker should be automatically adding the imports. His error checking code is doing the wrong thing.

@Manindra29

This comment has been minimized.

Show comment
Hide comment
@Manindra29

Manindra29 Sep 9, 2015

Member

@benfry I wasn't aware of this behaviour. So the current preprocessor (as part of the JavaBuild), adds the import statements to the processed java code of the sketch for classes that it can't find? Please clarify.

Member

Manindra29 commented Sep 9, 2015

@benfry I wasn't aware of this behaviour. So the current preprocessor (as part of the JavaBuild), adds the import statements to the processed java code of the sketch for classes that it can't find? Please clarify.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 9, 2015

Member

@Manindra29 Imports for any packages found in a JAR file in the code folder are automatically added by the preprocessor.

Member

benfry commented Sep 9, 2015

@Manindra29 Imports for any packages found in a JAR file in the code folder are automatically added by the preprocessor.

@Manindra29

This comment has been minimized.

Show comment
Hide comment
@Manindra29

Manindra29 Sep 14, 2015

Member

@benfry I've now added the logic to automatically add code folder imports. @colouredmirrorball, feel free to checkout the latest master.

Member

Manindra29 commented Sep 14, 2015

@benfry I've now added the logic to automatically add code folder imports. @colouredmirrorball, feel free to checkout the latest master.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 14, 2015

Member

Thanks Manindra.

Member

benfry commented Sep 14, 2015

Thanks Manindra.

JakubValtar added a commit to JakubValtar/processing that referenced this issue Sep 21, 2015

Revert "Implemented code folder imports. Fixes #3732"
This reverts commit 2450880.

Conflicts:
	java/src/processing/mode/java/pdex/ASTGenerator.java
	java/src/processing/mode/java/pdex/ErrorCheckerService.java
	java/src/processing/mode/java/pdex/XQPreprocessor.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment