java idea提示Type may be primitive类型可能/可以是原始的


  public void example() {
    Integer value = 12;
    needBox(value);
    for (int i = 0; i < 10; i++) {
      // Loop usages considered as happening more often
      needPrimitive(value);
    }
  }

  void needPrimitive(int value) {}
  void needBox(Integer value) {}
After the quick-fix is applied:
  public void example() {
    int value = 12;
    needBox(value);
    for (int i = 0; i < 10; i++) {
      // Loop usages considered as happening more often
      needPrimitive(value);
    }
  }

  void needPrimitive(int value) {}
  void needBox(Integer value) {}

Type may be primitive 
Inspection info: Reports local variables of wrapper type that are mostly used as primitive types.
In some cases, boxing can be source of significant performance penalty, especially in loops.
Heuristics are applied to estimate the number of boxing operations. For example, conversions inside loops are considered as much more numerous.

类型可以是原始的  

检查信息:报告包装器类型的局部变量,这些变量主要用作原始类型。  

在某些情况下,装箱可能会导致显著的性能损失,特别是在循环中。  

应用启发式方法估计装箱操作的次数。 例如,循环内部的转换被认为要多得多。

转为原始类型
比如:Double -> double
    Integer -> int
    Long -> long

你可能感兴趣的:(java代码规范,intellij-idea,java,intellij,idea)