在2013 年的这个问题中,奥德斯基先生指出,"现在判断"像Scalaz这样的图书馆是否能够在Dotty下存在(至少在他们当前的状态下),这是由于高级和存在类型的阉割所致.
在过去的时间里,Dotty对Scalaz&Cats的影响已被阐明了吗?内置效果和记录等提议的功能是否会改变这些项目的范围?
我知道Dotty仍然可以替代scalac,但是当我考虑投入时间将纯粹的功能结构和方法应用到我的工作中时,我认为考虑其旗舰库的未来很重要.
我正在尝试创建一个模块化的可执行jar文件,可以java -p <jar file> -m <module>在Java 9.0.1上运行.
当使用和生成jar时jar cfe test.jar test.Main -C classes/ .,这可以正常工作,但是module test does not have a MainClass attribute, use -m <module>/<main-class>在使用mvn package和生成时抛出mvn assembly:single.
这些maven生成的jar仍然可以使用java -p test.jar -m test/test.Main,并且所有jar都在classpath上工作java -jar test.jar.
我检查了罐子的内容jar xf test.jar,发现罐子完全相同,除了清单(见下文):
Manifest-Version: 1.0
Created-By: 9.0.1 (Oracle Corporation)
Main-Class: test.Main
Run Code Online (Sandbox Code Playgroud)
和
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: testuser
Build-Jdk: 9.0.1
Main-Class: test.Main
Run Code Online (Sandbox Code Playgroud)
值得注意的是,java -p test.jar -m …
我了解Java平台模块系统(JPMS)对大型应用程序的好处,但有没有理由将小型库或应用程序转换为(单个)模块?如果是这样,Modular Jar Files是实现这一目标的最佳方法,还是首选的常规方法?
展望未来,模块化的v.类路径程序会有性能影响吗?
我想触发许多一次性异步 CompletableFutures,如下所示:
for (Job job : jobs) {
CompletableFuture.supplyAsync(() -> job.process())
.whenComplete(this::doSomething);
}
Run Code Online (Sandbox Code Playgroud)
理想情况下,这些 CompletableFutures 可以在whenComplete完成后被垃圾回收。但是,由于我没有存储参考文献,因此是否存在事先收集它们的风险?
设置这个 Leaf Target 的想法是让每个线程有 4 个叶子;因此,如果一个线程提前结束,它将有大量的机会窃取工作。
但是 getCommonPoolParallelism() 不再返回 #cores.. 它而是返回 #cores - 1。那么为什么这是当前的 LEAF_TARGET?
使用以下命令可以轻松编译 Java 源代码--enable-preview:
<!-- Enable preview features -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>15</release>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但你怎么能跑呢exec:java?使用
<!-- Exec plugin.. run with `mvn exec:java` -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>${mainClass}</mainClass>
<commandlineArgs>--enable-preview</commandlineArgs>
<arguments>
<argument>--enable-preview</argument>
</arguments>
</systemProperties>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
仍然会出现以下错误:
An exception occured while executing the Java class.
Preview features are not enabled for Main (class file version 59.65535).
Try running with '--enable-preview'
Run Code Online (Sandbox Code Playgroud) java ×5
java-9 ×2
maven ×2
asynchronous ×1
dotty ×1
forkjoinpool ×1
java-14 ×1
java-platform-module-system ×1
java-stream ×1
module-info ×1
scala ×1
scala-cats ×1
scalaz ×1