Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Proposed changes to expose error/warning messages in ajde tests

> Also, there are standard message renderers and printers in MessageUtil,
if you'd like
> to avoid custom StringBuffer stuff.  E.g.,

Doh! Thanks for the pointer - I'll look into using these instead.

>I like this idea, coupled with a flag that disables them by default,
perhaps
> static boolean AjdeTestCase.DEBUG, to avoid delays caused by slow
consoles.

I mostly lean to the "turn all warning levels to max and keep the build
output clear" school of development, so suppressing messages by default
doesn't seem right to me, However, I agree that we don't want to flood the
console with error/warning messages that we are *expecting* the test case
to generate - so the ideal solution is to suppress expected messages by
default but always show unexpected ones. That of course means extending the
test cases to inform the task list manager whether or not messages are
expected (and perhaps which ones???) - and in some cases tidying up the
tests themselves from the look of some of the output. This latter solution
will create more disturbance than I want to introduce for now, so we could
go with your scheme initially and then refine after 1.1.0?

-- Adrian.
adrian_colyer@xxxxxxxxxx





09 May 2003 10:55
To: aspectj-dev@xxxxxxxxxxx
cc:
From: Wes Isberg <wes@xxxxxxxxxxxxxx>
Subject: Re: [aspectj-dev] Proposed changes to expose error/warning
messages in  ajde tests



I like this idea, coupled with a flag that disables them by default,
perhaps
static boolean AjdeTestCase.DEBUG, to avoid delays caused by slow consoles.

Also, there are standard message renderers and printers in MessageUtil, if
you'd like
to avoid custom StringBuffer stuff.  E.g.,

  MessageUtil.renderMessage(IMessage)
  MessageUtil.MESSAGE_SCALED.renderToString(IMessage)

Wes

Adrian Colyer wrote:

> In the course of tracking down the character encoding bug, I made the
> following two (local) changes to the Ajde testsrc tree to expose
> error/warning messages. All tests still pass (though you'll now see quite
a
> few warning messages that were previously suppressed). Since these
changes
> do not affect the built image, and improve our ability to diagnose and
fix
> ajde test failures, I propose we commit them as part of the run up to
> 1.1.0. I'll do that if there are no objections by tomorrow...
>
> Cheers,
> Adrian.
>
> Index: BuildConfigurationTests.java
> ===================================================================
> RCS file:
>
/home/technology/org.aspectj/modules/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java,v
> retrieving revision 1.7
> diff -u -r1.7 BuildConfigurationTests.java
> --- BuildConfigurationTests.java    6 May 2003 12:48:04 -0000     1.7
> +++ BuildConfigurationTests.java    9 May 2003 09:30:58 -0000
> @@ -463,6 +463,7 @@
>       }
>
>       protected void setUp() throws Exception {
> +           TaskListManager tlm = new NullIdeTaskListManager();
>             preferencesAdapter = new UserPreferencesStore(false);
>             buildOptions = new AjcBuildOptions(preferencesAdapter);
>             compilerAdapter = new CompilerAdapter();
> @@ -472,7 +473,7 @@
>              String s = null;
>              Ajde.init(
>                  null,
> -                null,
> +                tlm,
>                  null,
>                  projectProperties,
>                  buildOptions,
> @@ -486,6 +487,7 @@
>                  + LangUtil.renderException(t);
>              assertTrue(s, false);
>          }
> +
>       }
>
>       protected void tearDown() throws Exception {
> Index: NullIdeTaskListManager.java
> ===================================================================
> RCS file:
>
/home/technology/org.aspectj/modules/ajde/testsrc/org/aspectj/ajde/NullIdeTaskListManager.java,v
> retrieving revision 1.5
> diff -u -r1.5 NullIdeTaskListManager.java
> --- NullIdeTaskListManager.java     5 May 2003 15:18:01 -0000     1.5
> +++ NullIdeTaskListManager.java     9 May 2003 09:30:58 -0000
> @@ -43,6 +43,23 @@
>          if (!hasWarning &&
> IMessage.WARNING.isSameOrLessThan(message.getKind())) {
>              hasWarning = true;
>          }
> +        StringBuffer sb = new StringBuffer();
> +        sb.append(message.getKind().toString().toUpperCase());
> +        sb.append(": ");
> +        sb.append(message.getMessage());
> +        ISourceLocation l = message.getISourceLocation();
> +        if (l != null) {
> +           try{
> +                       sb.append(l.getSourceFile().getCanonicalPath());
> +           }
> +           catch(Exception e) {
> +                       sb.append(l.getSourceFile());
> +           }
> +           sb.append(":");
> +           sb.append(l.getLine());
> +        }
> +        System.err.println(sb.toString());
> +
>  //         System.out.println("> added sourceline task: " + message + ",
> file: " + sourceLocation.getSourceFile().getAbsolutePath()
>  //               + ": " +  sourceLocation.getLine());
>      }
>
> -- Adrian.
> adrian_colyer@xxxxxxxxxx
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-dev

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
 http://dev.eclipse.org/mailman/listinfo/aspectj-dev



Back to the top