|
From: Peter C. <cen...@ri...> - 2002-04-19 10:22:38
|
Indent Group:
I think I may have found a bug in the indent decision tree.
Take a look at this example from DrJava.java:
private static void _setupCompilerIfNeeded() {
if (CompilerRegistry.ONLY.isNoCompilerAvailable()) {
// no compiler available; let's try to let the user pick one.
final String[] text = {
"DrJava can not find any Java compiler. Would you ",
"like to configure the location of the compiler? ",
"The compiler is generally located in 'tools.jar', ",
"in the 'lib' subdirectory under your JDK ",
"installation directory. (If you say 'No', DrJava ",
"will be unable to compile programs.)"
};
int result = JOptionPane.showConfirmDialog(null,
text,
"Compiler not found",
JOptionPane.YES_NO_OPTION);
Notice that the declaration of "result" is indented an extra
level, as are the non-first elements of the declaration of
"text". I'm mildly surprised that the closing bracket is
matched properly, since it is backing up an extra level of
indentation. Is the code correctly handling this type of array
initialization?
Another detail, which I'm not sure is a bug or a feature
request: If you comment out code with /* */ and then reindent
it as part of a block selection, all lines are aligned left,
losing the original indentation. I imagine that this would also
destroy any manual ASCII table alignment within comments. Is it
possible to ignore lines within comments when doing a block
re-indent? This issue is especially troublesome because an
indent operation is not easy to undo with the current
implementation.
Is there any central documentation (maybe a flow chart) for the
decision tree as it is currently implemented? I think it would
be helpful to be able to debug the logic separately from the
implementation, since there is a significant amount of code to
scan.
--
Peter
|