zoukankan      html  css  js  c++  java
  • Java高效开发IntelliJ IDEA 2019.1 新特性

    1. 重构类、文件、符号,Action 搜索

    IntelliJ IDEA(以下简称 IDEA) 中的搜索可以分为以下几类

    1. 类搜索,比如 Java,Groovy,Scala 等类文件
    2. 文件搜索,类文件之外的所有文件
    3. 符号搜索,包括接口名,类名,函数名,成员变量等
    4. Action 搜索,找到你的操作
    5. 字符串搜索及替换

    在 IDEA 的世界里,搜索无处不在,你几乎可以瞬间找到你想要找到的任何一行代码甚至任何一个字。新版中,IDEA 更是将类、文件、符号、Action 搜索与双 Shift 键调出来的 Search Everywhere 无缝地结合在一起。

    通过书写配置文件的方式自定义UI

    High contrast高对比度主题套餐, 硬核的朋友可尝试一下

    JavaSwitch

    • 在Java12的新特性中, switch表达式可以被增强为类似箭头函数的形式;

    可以合并同样处理逻辑的switch选项.

    变量提取

    • 变量提取得到了增强, 现在可以将相同语义的代码进行提取

    根据上下文的不同, IDE会将if表达式转换为三元表达式.

    三元表达式中更精确的警告

    在之前的IDEA中, 其对非空限定的三元表达式的检测为"高亮整个表达式", 现在可以精确高亮违法约定的那部分了;

    表达式中的数学检测

    注解

    • @Contract 注解

    @Contract 注解用于标识方法所需遵循的限定, 它有2个属性:

    value: 包含描述参数和返回值之间因果关系;

    pure: 用于只返回新值不更改对象状态的方法, 参见

    If its return value is not used, removing its invocation will not affect program state or change the semantics, unless the method call throws an exception (exception is not considered to be a side effect). A method should not be marked as pure if it does not produce a side effect by itself, but it could be used to establish the happens-before relation between an event in another thread, so that changes performed in another thread might become visible in current thread after invocation of this method. On the other hand, some synchronized methods could be marked as pure, because the purpose of synchronization here is to keep the collection internal integrity rather than to wait for an event in another thread. "Invisible" side effects (such as logging) that do not affect important program semantics are allowed.

    • 根据参数所使用的的方法, IDEA会建议加上注解

    堆栈跟踪

    现在可以在进行堆栈跟踪时直接定位到具体位置了, 而非以前的只定位到所属行.

    Gradle

    • 现在可以将构建和运行操作委托给Gradle(支持对每个项目单独分级)

    可以为同一个项目的测试运行程序和应用程序运行程序设置不同的值 (此版本IDEA中默认将项目委指定为Gradle管理)

    • Gradle支持从选择测试任务列表中进行选择

    HotSwap可以触发Gradle或Maven的构建


    转载于:https://juejin.im/post/5cff4288f265da1b8a4f1339

  • 相关阅读:
    18.11.5 考试总结
    18.11.2 考试总结
    18.11.1 考试总结
    洛谷 P1084 疫情控制 noip2013D2T3
    18.10.31 考试总结
    洛谷P1312 Mayan游戏 noip2011D1T3
    18.10.30 考试总结
    【考前复习_各类模板之补充】
    NOIP2016之反面教材提供
    【最后的抒情】【离NOIP还有9个小时】
  • 原文地址:https://www.cnblogs.com/twodog/p/12134831.html
Copyright © 2011-2022 走看看