- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建一个 multi-release jar使用 Maven (3.8.0)。我们调用 sun.misc.Unsafe
在java8和java11中编译得很好。但是,使用 java11 --release 8
编译引发 Compilation failure: package sun.misc does not exist
.
以下是重现错误的方法:
一个调用 Unsafe
的简单类:
public class ChangeableObjects {
sun.misc.Unsafe unsafe;
}
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
</plugins>
</build>
<release>8</release>
行,它在 java8 和 java11 上运行良好。
sun.misc
包已在 java8 和 java9 之间移动。但仍然是
release
的目的标志是用java8编译好的代码也应该用java11编译好。
release
旗帜?我需要链接
sun.misc
吗?手动打包以使其工作?
最佳答案
首先,如评论中所述,不推荐我构建多版本 jar 的方式(按照我提供的链接)。使用空指针给出的例子,
I would prefer to use something like https://github.com/meterware/multirelease-parent/blob/master/pom.xml
--release 8
编译时会出现编译错误的答案实际上是由指向
https://stackoverflow.com/a/43103038/296328 的 khmarbaise 给出的:
javac provides two command line options, -source and -target, which can be used to select the version of the Java language accepted by the compiler and the version of the class files it produces, respectively. By default, however, javac compiles against the most-recent version of the platform APIs. The compiled program can therefore accidentally use APIs only available in the current version of the platform. Such programs cannot run on older versions of the platform, regardless of the values passed to the -source and `-target. options. This is a long-term usability pain point, since users expect that by using these options they'll get class files that can run on the specified platform version.
关于java9 '-release 8' 带有内部包(例如 sun.misc.Unsafe),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53560584/
已结束。此问题不符合 Stack Overflow guidelines .它目前不接受答案。 我们不允许提出有关书籍、工具、软件库等方面的建议的问题。您可以编辑问题,以便用事实和引用来回答它。 关闭
在我正在开发的 crate 中,我有几个 unsafe 函数,由于某些原因它们被标记为 explained in this answer .在 unsafe 函数中,我可以执行 unsafe 操作,就
我一直在尝试在我的网络应用程序中设置文本编辑器。在哪里访问文本编辑器我必须允许 script-src 'self' 'unsafe-inline' 'unsafe-eval' 和 style-src
我是后端开发人员,正在帮助前端团队部署 Web 服务器,同时我正在研究遇到内容安全策略的漏洞,如果我将 CSP header 设置为“内容安全策略:默认源代码‘自我’数据: {own_domain_1
Unsafe.putAddress(long address, long x) 之间有什么区别?方法和Unsafe.putLong(long address, long x)方法? 最佳答案 Java
考虑以下代码: const defaultState = () => { return { profile: { id: '', displayName: '',
上面有一条评论 public native void unpark(对象线程); “取消阻塞在park上阻塞的给定线程,或者,如果它没有阻塞,则导致后续对park的调用不阻塞。注意:此操作“不安全”,
我已将 unsafe.cpp 和 Unsafe.java 克隆到自定义版本。我要构建新的 JVM,但似乎我的 UnsafeNew.java 内联了 unsafe.cpp 方法,而不是新的 unsafe
为什么会出现以下错误? Unsafe code may only appear if compiling with /unsafe"? 我使用 C# 和 Visual Studio 2008 在 Wi
我正在用 C# 做一个项目,它可以从线性代数包中获益。我看过外面的那些,但我真的不想付钱,或者我发现它们不是很好。所以我决定自己写。 我读到 C++ 数组比 C# 数组快得多,但在 C# 中使用指针数
在 Java 中,java.lang.unsafe 包中有 Unsafe 类,它提供对操作的低级访问。 现在在我看来,JVM 需要支持Unsafe 类中可用的所有 方法,以便与 JLS 兼容,示例方法
我正在尝试将选项卡存储在本地存储中并在刷新页面上获取前面的选项卡,数据存储在本地但是在控制台上的时候我得到错误 Error: [$sce:unsafe] Attempting to use an un
导入类型化函数时,我收到 no-unsafe-call 和 no-unsafe-assignment eslint 错误。如果函数在同一个文件中声明,错误就会消失。 eslint 似乎无法获取导入函数
我正在尝试在 Visual Studio App Center 中构建 Xamarin iOS 应用程序。该解决方案包含两个项目。一个是 Xamarin iOS 项目。另一个是绑定(bind)库项目。
Unsafe Fileupload 1.client check 标题叫客户端check,文件校验应该是在客户端进行的。 可以先把一句话木马改成图片格式,然后再抓包修改回PHP格式。 一句话木马内容:
我想问一下第一个例子是否比第二个例子慢。 例子1:for, unsafe, unsafe, unsafe, etc for (var i = 0; i ' { } // end of class .
我尝试通过在 Controller 中生成链接将书签按钮添加到我的网站。 模板部分: + Add Controller 部分: $scope.getCode = fun
我注意到在 Java 7 中,集合类(在我的例子中是 ConcurrentLinkedQueue)使用 UNSAFE 类进行交换和查找操作。 偏移量似乎是在编译时声明中计算的: itemOffset
我有一张图片: 在 html 上我得到的结果是: unsafe:c:/var/vci/images/fleetImages/IMG_20150912_091552.jpg 我已经在app.js中添加
这是实现原生pinvok代码的类 虽然我无法验证它是否正确使用了 unsafe,但它似乎可以工作 不安全的签名 struct IO_COUNTERS { public
我是一名优秀的程序员,十分优秀!