javac

Regarding automatic recompilation, I can't spot the difference between javac's -classpath and -sourcepath options

不打扰是莪最后的温柔 提交于 2020-01-03 06:25:08
问题 I'm trying to understand the difference between javac's -classpath and -sourcepath options, regarding automatic recompilation of source code files. I read the Java documentation on the subject of javac, and for its -sourcepath option it stated - Note: Classes found through the class path may be subject to automatic recompilation if their sources are also found I also looked at this webpage (idevelopment.info), to learn more about javac's -classpath and -sourcepath options. In their example,

Is the class file generated by javac always the same?

两盒软妹~` 提交于 2020-01-02 03:31:11
问题 Currently we are in the process of re-scripting all of our build system for a large project (around 2000 source files) and there has been talk of doing a binary comparison on the files to ensure that everything is correct which leads to the following question: Is the output of javac guaranteed to be same across compilations or could it be subject to change? Another question implied that the constant pool could have a different order, but assuming we are able to control for the order of the

How to suppress the “requires transitive directive for an automatic module” warning properly?

Deadly 提交于 2020-01-02 02:23:06
问题 After upgrading a Maven project to Java 9 and adding a module descriptor, javac complains about a transitive dependency for an automatic module: [WARNING] /.../src/main/java/module-info.java:[3,35] requires transitive directive for an automatic module An example module-info.java to reproduce the problem: module com.example.mymodule { exports com.example.mymodule.myexportedpackage; requires transitive com.google.common; } The meaning of this warning is completely clear, here are some related

How to suppress the “requires transitive directive for an automatic module” warning properly?

断了今生、忘了曾经 提交于 2020-01-02 02:23:02
问题 After upgrading a Maven project to Java 9 and adding a module descriptor, javac complains about a transitive dependency for an automatic module: [WARNING] /.../src/main/java/module-info.java:[3,35] requires transitive directive for an automatic module An example module-info.java to reproduce the problem: module com.example.mymodule { exports com.example.mymodule.myexportedpackage; requires transitive com.google.common; } The meaning of this warning is completely clear, here are some related

why is this code not compiling with javac but has no errors in eclipse?

☆樱花仙子☆ 提交于 2020-01-01 10:06:14
问题 the following code: @Retention(RetentionPolicy.RUNTIME) @Target( { ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE }) @Constraint(validatedBy = { MinTimeIntCoConstraintValidator.class, MinTimeIntCoListConstraintValidator.class, MinTimeDoubleCoConstraintValidator.class, MinTimeDoubleCoListConstraintValidator.class, }) @Documented public @interface MinTimeValueCo { int value(); String message() default "value does not match minimum requirements"; Class<?>[] groups() default {

Inferred type does not conform to equality constraint error for unrelated variables

こ雲淡風輕ζ 提交于 2020-01-01 05:08:47
问题 I have the following piece of code public class TeeingCollector { public static void main(String[] args) { // var strs = List.of("abc"); var dividedStrings = Stream.of("foo", "hello", "bar", "world") .collect(Collectors.teeing( Collectors.filtering((String s) -> s.length() <= 3, Collectors.toList()), Collectors.filtering((String s) -> s.length() > 3, Collectors.toList()), List::of )); System.out.println(dividedStrings); } private static class Employee { boolean isActive; public Employee

java compiler's target version “jsr14” with JDK7/8

一世执手 提交于 2020-01-01 02:35:06
问题 Can anybody tell me the jsr14 target option of javac will be still available with JDK7/8? Say, $ javac -source 1.5 -target jsr14 Hello.java 回答1: We are heavily using -jsr14 in OSGi because it allows us to use generics in our API but still deploy on 1.4 environments, which are still popular in embedded. Unfortunately, they made JDK 7 not backward compatible with Java 6 and 5. Javac 1.7 ignores the generic information that is actually present in the JAR files. There is fortunately no problem at

Is it possible to get maven to accept maxerrs for its compiler plugin?

梦想与她 提交于 2019-12-31 00:55:11
问题 I have a project where I am responsible for fixing some errors and another developer is responsible for other errors. The number of errors is well over a hundred, and as I'm fixing my errors, her errors are piling up. I'm at the point where I see 99 of her errors and one of mine, and I assume I will soon get to a point where it is 100 of hers. I looked into using this configuration for maven: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId>

Can I tell javac to ignore the lack of `import foo.Bar`?

与世无争的帅哥 提交于 2019-12-31 00:43:51
问题 I'm using reflection to load MyClass.class (an external file) at runtime. MyClass.class uses the library Bar , which would mean that I need to place import foo.Bar; at the top of the file. However, the Bar library is already loaded in the main class loading MyClass . Is there a way for me to tell javac to ignore that Bar doesn't exist and just compile without it? 回答1: No this is not possible. When compiling a class, the compiler has no "memory" of which classes were already "loaded" (don't

Exception in thread “main” java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path

泪湿孤枕 提交于 2019-12-30 18:55:53
问题 I'm building the basic Slick game example explained here: http://slick.cokeandcode.com/wiki/doku.php?id=01_-_a_basic_slick_game, and I'm running into some problems. Specifically, the game compiles just fine, but when I try to run it, Java complains: Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1856) at java.lang.Runtime.loadLibrary0(Runtime.java:845) at java.lang.System.loadLibrary(System.java