You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Karl Wright (JIRA)" <ji...@apache.org> on 2016/06/21 18:46:58 UTC
[jira] [Comment Edited] (LUCENE-7194) Ban Math.toRadians/toDegrees
and remove all usages of it
[ https://issues.apache.org/jira/browse/LUCENE-7194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15342425#comment-15342425 ]
Karl Wright edited comment on LUCENE-7194 at 6/21/16 6:46 PM:
--------------------------------------------------------------
Here's what it spits out:
{code}
[forbidden-apis] Forbidden method invocation: java.lang.Math#toRadians(double) [Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:94)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toRadians(double) [Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:95)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toDegrees(double) [Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:121)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toDegrees(double) [Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:121)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toDegrees(double) [Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:121)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toDegrees(double) [Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:121)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toRadians(double) [Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:151)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toDegrees(double) [Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:169)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toRadians(double) [Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.util.SloppyMath (SloppyMath.java:212)
[forbidden-apis] Scanned 2733 (and 585 related) class file(s) for forbidden API
invocations (in 2.98s), 9 error(s).
{code}
was (Author: kwright@metacarta.com):
Here's what it spits out:
{code}
[forbidden-apis] Forbidden method invocation: java.lang.Math#toRadians(double) [
Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:94)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toRadians(double) [
Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:95)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toDegrees(double) [
Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:121)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toDegrees(double) [
Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:121)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toDegrees(double) [
Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:121)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toDegrees(double) [
Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:121)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toRadians(double) [
Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:151)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toDegrees(double) [
Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.geo.Rectangle (Rectangle.java:169)
[forbidden-apis] Forbidden method invocation: java.lang.Math#toRadians(double) [
Use NIO.2 instead]
[forbidden-apis] in org.apache.lucene.util.SloppyMath (SloppyMath.java:212)
[forbidden-apis] Scanned 2733 (and 585 related) class file(s) for forbidden API
invocations (in 2.98s), 9 error(s).
{code}
> Ban Math.toRadians/toDegrees and remove all usages of it
> --------------------------------------------------------
>
> Key: LUCENE-7194
> URL: https://issues.apache.org/jira/browse/LUCENE-7194
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Robert Muir
> Assignee: Karl Wright
>
> The result of these methods is unreliable and changes across jvm versions: we cannot use these methods.
> The following program prints 0.7722082215479366 on previous versions of java but 0.7722082215479367 on java 9 because Math.toRadians is no longer doing the same thing:
> {code}
> public class test {
> public static void main(String args[]) throws Exception {
> System.out.println(Math.toRadians(44.244272));
> }
> }
> {code}
> This is because of https://bugs.openjdk.java.net/browse/JDK-4477961.
> I am not really sure its a bug, because the method says that the conversion is "generally inexact".
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org