java-10

Different behavior of WeekFields on JVM 8 and JVM 10

故事扮演 提交于 2019-12-09 08:09:02
问题 I have really simple program here: public static void main(String[] args) { LocalDate year = LocalDate.ofYearDay(2022, 100); System.out.println(year); System.out.println(WeekFields.of(Locale.GERMAN).weekOfYear()); System.out.println(year.with(WeekFields.of(Locale.GERMAN).weekOfYear(), 0)); System.out.println(year.with(WeekFields.of(Locale.GERMAN).weekOfYear(), 0).with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))); } But it behaves differently on JVM 8 and JVM 10. The problem seems to

Can Java 10 type inference for local variables infer void?

只谈情不闲聊 提交于 2019-12-08 23:39:29
问题 With Java 10, we can use type inference. String s1 = "hello"; // before Java 10 var s2 = "hello"; // now However, there is one thing which we couldn't do before: have variables of type void . So, in previous versions we simply couldn't define the variable type void . But now we can assign result of method returning void to the variable: void emptyMethod() { } ... void v1 = emptyMethod(); // won't compile var v2 = emptyMethod(); // no problem at all The question is - why does it even compile,

How to upgrade javax.naming.* and javax.xml.* imports to be compatible with java 10

安稳与你 提交于 2019-12-08 10:12:16
问题 I have a java project built with maven and jdk 1.8. Some classes use javax.naming.* and javax.xml.* classes in the jdk. From Java 9 onwards those javax packages have been removed from the jdk. So how do I upgrade the project to run on java 9 or later? Here are the classes, import javax.naming.Binding; import javax.naming.Context; import javax.naming.Name; import javax.naming.NameClassPair; import javax.naming.NameParser; import javax.naming.NamingEnumeration; import javax.naming

JavaFX 9/10 no longer possible to override TableView.resizeColumnToFitContent

自闭症网瘾萝莉.ら 提交于 2019-12-08 05:22:26
问题 In JavaFX 8 it was possible to override the TableView.resizeColumnToFitContent function. This is vital for our purposes since it allows us to enhance the way column headers are laid out beyond the default implementation, as well as to tune the performance where the default suffers somewhat in larger tables. One example of how the layout behaviour has been enhanced is in the context of nested column headers. By default a leaf column header's prefWidth is set according to either the max width

Jaxb package-info ignored when using Java 10

ε祈祈猫儿з 提交于 2019-12-08 02:20:24
问题 I'm struggling with this, and any information would be greatly appreciated. I have a project that has been using JAXB for some time to construct a Java Model from an XML Schema and uses that model. This has been working in Java 8 for some tie now. However, I've upgraded to Open JDK 10 and I get this error when I attempt to Unmarshall an XML file into the Java objects.... java.lang.IllegalArgumentException: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.minestar.cat.com

Netbeans 9.0 Incubating - Does not make `lib` directory in `dist` for migrated/updated Java 10 project

假装没事ソ 提交于 2019-12-07 20:46:59
问题 I have started using NetBeans 9.0 (incubating) with Java 10. I created a new test Java Application project and ticked 'Use Dedicated Folder for Storing Libraries' ('\lib') when creating it. I also set the JDK/Java version to 10 . I then included Apache Commons Codec 1.11 as a dependency library. I didn't do anything else, other than import the Base64 class from the binary package in the main class. However, when I build the application, NetBeans doesn't create a lib directory in the dist

Javadocs are not appearing on Apache netbeans for java 10

青春壹個敷衍的年華 提交于 2019-12-07 16:12:38
问题 Netbeans Version: Apache NetBeans 9.0 Java version: Java 10 No matter what I do, I can't get the javadocs to appear and display method details on anything. I've gone into the Java Platforms and into the Javadocs, I've set the Zip, unzipped and URL for the javadocs, but it just wont work... Java Doc: jdk-10.0.1_doc-all URL: https://docs.oracle.com/javase/10/docs/api I couldn't find any answers anywhere, they all mentioned adding the docs like I already tried. Edit Reply: Even with adding the

Advantages/Drawbacks of “var” in Java 10 [closed]

一笑奈何 提交于 2019-12-07 14:20:45
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . AFAIK, var is not keyword in Java . It is reserved type name . I wonder that in what circumstances we should use/avoid it. Are there principles about its usage? import java.util.HashMap; public class Test { public static void main(String[] args) { var x = new HashMap<> (); //

How to filter the age while grouping in map with list

喜欢而已 提交于 2019-12-07 02:27:20
问题 Similar to my previous question here, the User objects I have are these new User("ayush","admin",23) new User("ashish","guest",19) new User("ashish","admin",20) new User("garima","guest",29) new User("garima","super",45) new User("garima","guest",19) Now I am trying to get the name to varying ages trend for these users. But I need to filter them above a threshold age. I could get the trend using Map<String, List<Integer>> userNameAndAgeTrend = users.stream().collect(Collectors.groupingBy(user

Patch or override an implementation of a core Java 10 class

烈酒焚心 提交于 2019-12-06 18:19:55
问题 There is a bug in JFX which often manifests when calculating screen co-ordinates https://bugs.openjdk.java.net/browse/JDK-8194727 and https://bugs.openjdk.java.net/browse/JDK-8190400 I've tracked the problem down to the implementation of GeneralTransform3D, which is part of the javajfx runtime. I've submitted a bug report to Oracle, but until it is accepted, fixed, and makes it to a release, I need a way of fixing my application. In java 8 i was able to create a jar containing a fixed version