首页 \ 问答 \ Intellij代码格式化,新行上的Java注释(Intellij code formatting, Java annotations on new lines)

Intellij代码格式化,新行上的Java注释(Intellij code formatting, Java annotations on new lines)

我正在使用IntelliJ 12,它将我的成员变量注释放在同一行,我讨厌! 如何设置代码格式化程序以在不同的行上保留注释?

谢谢!


I'm using IntelliJ 12 and It's putting my member variable annotations on the same line, which i hate! How do I setup the code formatter to keep annotations on separate lines?

thanks!


原文:https://stackoverflow.com/questions/15284911
更新时间:2023-12-08 16:12

最满意答案

尝试这个:

public interface PopulationMember<T extends PopulationMember> extends Comparable<T> {
    int compareTo(T o);
    T merge(T o);
    // Some other stuff

}

当你填写一个类型参数(就像你为Comparable做的那样),你需要提供一个类。 如果你不希望它是一个特定的类,你可以参数化你的接口。


Try this:

public interface PopulationMember<T extends PopulationMember> extends Comparable<T> {
    int compareTo(T o);
    T merge(T o);
    // Some other stuff

}

When you fill in a type parameter (as you do for Comparable), you need to provide a class. If you don't want it to be a specific class, you can parameterize your interface.

相关问答

更多
  • 不,这不是真的。 你可以转换为 2^f(n) = n^O(1) 因为f(n) < c*log2(n) (对于大n )仅表示 2^f(n) < 2^(c*log2(n)) = (2^log2(n))^c = n^c 有一些未公开的常数c 。 No, it is not true. You can transform to 2^f(n) = n^O(1) as f(n) < c*log2(n) (for large n) only implies 2^f(n) < 2^(c*log2(n)) = (2^l ...
  • 我想你正在寻找这个: library(dplyr) df %.% group_by(V4) %.% mutate(V12 = V2 - V2[1]) I suppose you're looking for this: library(dplyr) df %.% group_by(V4) %.% mutate(V12 = V2 - V2[1])
  • 尝试这个: public interface PopulationMember extends Comparable { int compareTo(T o); T merge(T o); // Some other stuff } 当你填写一个类型参数(就像你为Comparable做的那样),你需要提供一个类。 如果你不希望它是一个特定的类,你可以参数化你的接口。 Try this: public interface ...
  • 在Russ Cox和Ian Lance Taylor的博客上有很多关于界面的好帖子,我建议您检查一下。 他们可能会涵盖你的问题和更多... 我认为一个好的概念例子就是网络包。 你会发现一个连接接口( Conn ),它由TCPConn , UnixConn和UDPConn实现 。 Go pkg源可能是Go语言的最佳文档。 There are some good posts on interfaces over at Russ Cox and Ian Lance Taylor's blog which i re ...
  • 虽然Python 2和3通过名义子类型 ( mixins )和抽象基类支持这种类型的功能,但如果你使用类型注释, PEP 544引入了使用Protocol进行静态鸭子类型的概念。 与Swift协议或Java接口类似, Protocol定义了子类型的接口(可选地包括属性和方法的默认实现)。 您可以通过导入typing-extensions模块在所有Python版本(3.5.0除外)中使用Protocols。 While Python 2 and 3 supports this type of function ...
  • 从iOS 3.2开始,您可以使用UIMenuController将其他UIMenuItem添加到在UIWebView中选择文本时出现的系统菜单。 这是一个简单的例子: - (void)viewDidLoad { [super viewDidLoad]; UIMenuItem *defineItem = [[[UIMenuItem alloc] initWithTitle:@"Define" action:@selector(defineSelection:)] autorelease]; ...
  • 完成:) 来自网络的这段代码真的帮助我做到这一点。 函数从类别名称中检索子类别的ID。
  • 我们在Global.asax.cs文件中使用这样的方法就是为了这个目的(它从Application_Start调用: private static void SetupScheduling(IKernel kernel) { var scheduler = SchedulerUtil.Scheduler; scheduler.JobFactory = kernel.Get(); scheduler.Start(); ...
  • Fibonacci序列是......好......一个序列。 因此,它可以: 按索引返回项目 返回下一个号码 我建议使用单个方法GetNextElement()创建一个接口ISequence 。 public interface ISequence { int GetNextElement(); } 然后,您可以在FibonacciSequence类中实现此接口: public class FibonacciSequence : ISequence { private int _lastE ...
  • public static int filterNumber(int x, int arbitraryNumber) { if (x < arbitraryNumber) { return x; } int result = x % arbitraryNumber; if (result == 0) { return arbitraryNumber; } return result; } public static int filterNumber(int x, ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。