问题标签 [jvm-languages]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
1091 浏览

java - 谁是JVM的所有者?

许多移动设备都带有带有其操作系统的 JVM(例如诺基亚、索尼爱立信)。所有设备都具有相同的 JVM 吗?JVM都是sun micro系统所有的吗?设备制造商是否已向 sun 微系统支付了费用?假设如果我想创建自己的 OWN JVM,我必须向 sun 微系统付费并获得 SUN(ORACLE) 的许可?如果不是真的,sun 是如何获得利润的?

0 投票
1 回答
1725 浏览

android - How to integrate Scala into core Android platform?

I am interested in integrating Scala (or some other non-Java JVM-language) into the android platform. I am not referring to writing an android application with Scala, that I did early early on, but actually hooking into the build process that builds the android platform source tree. I imagine this will be a matter of hooking into the makefiles and such. Does anyone have insight into this?

What I have so far: The platform source treefrom git://android.git.kernel.org/platform/manifest.git built in its virgin form, guided by "[Download and build the Google Android][1]"

  • build/core/combo/scalac.mk # Configures scala compiler related variables, included by config.mk
  • Added definitions in build/core/definitions.mk for an all-subdir-scala-files and an all-scala-files-under
  • Added definition in definitions.mk to build scala files such that they are included in the package

What's left:

  • Include scala-library.jar
  • Ensure changes to -bootclasspath has not broken anything
  • Figure out how to handle case where scala classes depend on java classes and visa versa
  • Major cleanup of code
  • Testing!
  • Figure out what to do (other than just posting them here) with the changes I've made

Looks like I'm almost there!!!

Some notes from the past

Latest: I have found where the Java source files are compiled! In definitions.mk, see 'define transform-java-to-classes.jar'. The latest idea is to write a transform-scala-to-classes definition and then have it store those classes in the directly that gets packaged. I will call transform-scala-to-class right before this step in transform-java-to-classes.jar. Support for eclipse and cygwin will for now be dropped as it clutters up the code with workarounds and therefore increases my chances of failure.

The build process starts out by the root Makefile running build/core/main.mk build/core/main.mk includes build/core/config.mk which includes build/core/combo/javac.mk which sets HOST_JAVAC, TARGET_JAVAC, and COMMON_JAVAC. COMMON_JAVAC is the "Java compiler command with common arguments," by the look of it the other two variables get these values by default, unless in a special environment (openjdk or eclipse). COMMON_JAVAC is not used outside this file. The other two are only used in build/core/definitions.mk.

build/core/java_library.mk (included by config.mk) seems to only be concerned with building jars. This is out of the scope of us caring. Any interaction with jars presupposes class files which presuppose that we were already successful in building our scala files.

There are checks in main.mk regarding the version of java. We will ignore these and assume that our version of scala is compatible. Right now (in combo/scalac.mk) I am using the same --target arg used in javac.mk. This should perhaps be stored in a variable.

main.mk also includes build/core/definitions.mk which in turns defines some useful functions. The one we care about here is all-java-files-under and all-subdir-java-files. The latter is used in Android.mk files to find java files. The former is used in the implementation of the latter. I will write Scala equivalents of them.

To figure out how the build process works, I am now running make with -n and others. I got this idea from the stackoverflow article "[Tool for debugging makefiles][2]". I am also investigating debugging with remake.

build/core/{config.mk, definitions.mk} gives us light as to which make files/commands are used to do what.

As a possible way of hacking in support on a per project bases, additional code could most likely be added to the project's Android.mk file. From platform/build/core/build-system.html we read "Android.mk is the standard name for the makefile fragments that control the building of a given module. Only the top directory should have a file named "Makefile"." You could create a new target like "scala-build" and run that (make PackageName scala-build) before the final make. One could perhaps also hide it sneakily in a variable assignment, mitigating the need for a target to be called explicitly.

Another way (far far more hackish) is to hijack the command being used for javac. This is set in build/core/combo/javac.mk. Your project's Android.mk will have to include *.scala files in LOCAL_SRC_FILES along with the *.java files.

0 投票
1 回答
1656 浏览

java - Clojure 在项目中的用例

当然,我并不是因为我可以就使用 Clojure。

我很好奇在何处/何时使用 Clojure 以及它为项目带来的价值。

假设我正在做 Java Web 开发,我可以在哪里使用 Clojure?您有什么用例吗?

谢谢。

0 投票
5 回答
1772 浏览

clojure - 学习如何编写 Clojure/Lisp 宏的书

我正在阅读“Programming Clojure”,我对一本讨论如何尽可能广泛地创建宏的书感兴趣。

你推荐一本书吗?

谢谢。

0 投票
2 回答
157 浏览

java - Java 平台的投资数据

是否有任何可用的市场研究数据来计算 Java平台的总投资(全球、按地区、按国家)?这可能包括软件(应用程序服务器、IDE、分析工具)、硬件(Sun 服务器、字节码执行处理器)、人员(培训、书籍)、语言开发(Java、Clojure、Scala ......)、公共/私人(大学、政府、企业)等。

我正在编写一个关于 JVM 语言的演示文稿,并且想以某种可靠的方式说明对 Java 平台的现有投资是巨大的,而且不会很快消失(想想 Cobol)。我确信这一点对于 IT 人员来说是清楚的,但我想在上面放一个美元数字,让业务人员真正将这一点带回家。

在评论开始之前,我认识到这个问题超出了我们大多数人认为“与编程相关”的范围。无论如何,了解这些信息可以帮助许多 IT 部门围绕平台的未来进行讨论,甚至可以帮助开发人员做出职业决策。

0 投票
5 回答
555 浏览

jvm-languages - 哪些 JVM 语言被解释而不是编译为字节码?

关于 JVM 语言的维基百科文章指出:

这些语言中的一些由 Java 程序解释,一些被编译为 Java 字节码......

Java 程序解释了哪些著名的通用 JVM 语言?

0 投票
2 回答
288 浏览

clojure - 类型擦除如何帮助 Clojure 存在?

JVM 类型擦除如何帮助 Clojure?没有它,Clojure 还能存在吗?如果 JVM 已经具体化了类型会发生什么?也就是说,Clojure 将如何改变?

0 投票
2 回答
1475 浏览

java - 面向程序员/开发人员的 JVM 内部规范参考

标题很好地抓住了我的问题。我想知道对于 JVM(不仅仅是 HotSpot,但这显然是开始的地方)如何实现或处理特定功能的问题是否有很好的资源或跳跃点?我不是在寻找JLSJVM Spec中的东西——我知道先去那里。

例如:当试图理解性能问题时,我们经常讨论的不是规范所说的,而是当代最佳实践在实际实现中的样子。例如,有一些都市神话说“final 类在 Java 中表现更好,因为 JVM 可以内联或以其他方式优化这些东西”。是否有我们可以求助的通用资源来评估这些漂浮的主张?

我通过特定于 HotSpot 的参考资料来回答我自己的问题。其他供应商的产品呢?小型 JVM 的细节?多核细节?平台细节,如果他们有所作为?其他 JVM 语言的细节?

只是为了避免一些潜在的抱怨:1)这不是寻找过早的优化(事实上,更好地了解平台应该会阻止受过良好教育的开发人员!);2) 我知道 Java 程序员应该专注于漂亮的、可移植的、随处运行的代码,但对我们中的许多人来说,平台细节最终很重要!

这是受到Thorbjørn Ravn Andersen对特定问题的一些有用评论的启发。除了我上面引用的例子之外,我很高兴收集其他一些更有帮助的例子,以激发人们为什么想要这些资源。

关于 SO 的一些有趣的相关问题:JVM 中的尾调用优化Killer JVM 特性明天将无用的优化、 JVM实现之间的差异

编辑添加: 我将把答案奖励给提到的最佳个人参考,或者提供指向一个网站(可能是为了响应这个问题而构建)的指针的人,该网站最能集中/分类 JVM 实现智慧和实际后果客户端语言和开发人员。

0 投票
4 回答
1129 浏览

scala - 在 Scala 中坚持功能范式的效果

我最近买了Programming Scala,并且一直在阅读它。语言绝对不是我所期望的!具体来说,它似乎实现了我所知道的几乎所有编程语言的想法,在 Lisp 宏和 Haskell 的类型级副作用隔离之外。

坦率地说,这让我有些不知所措。虽然我认为有这么多工具可供我使用是件好事,但我真的只是在 JVM 上寻找一种强类型的函数式语言。我想我可能会以这种方式使用 Scala,但我想如果我与任何库交互或浏览其他任何人的代码,我会遇到很多这种高级(对我而言)OOP 东西——特征和“对象层次结构”线性化”,所有这些抽象和压倒一切的业务、单例、包和伴随对象、隐式转换……更不用说各种语法快捷方式和糖了。

人们常常哀叹程序员试图将一种语言的风格硬塞到另一种语言中,这有很多很好的理由。但并非所有语言都像 Scala 那样具有多范式,所以也许它的社区有不同的看法?例如,在 F# 中,似乎在编程风格和使用多少 OOP 方面存在一些余地。但是仅仅从阅读中我不确定这对 Scala 是否也是一个好的哲学。

更有经验的 Scala 程序员可以在这里帮助我吗?为清楚起见进行编辑:基本上,我可以安全地仅(或大部分)使用 Scala 的 FP 功能,而不必担心其高级 OOP 方面吗?

对不起,漫无边际的问题!

0 投票
3 回答
401 浏览

clojure - 连接到 Clojure 的远程实例

我读到可以通过 REPL 连接到 Clojure 的远程生产实例。
你能给我解释一下吗?怎么做?
“Clojure 实例”是什么意思?