test/tools/javac/api/T6838467.java

changeset 882
3d45cc94ee0f
parent 554
9d9f26857129
child 923
6970d9fb8e02
     1.1 --- a/test/tools/javac/api/T6838467.java	Fri Feb 18 12:28:49 2011 +0000
     1.2 +++ b/test/tools/javac/api/T6838467.java	Fri Feb 18 08:12:06 2011 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2009, 2011 Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -32,7 +32,9 @@
    1.11  import java.util.zip.*;
    1.12  import javax.tools.*;
    1.13  import com.sun.tools.javac.file.JavacFileManager;
    1.14 +import com.sun.tools.javac.main.OptionName;
    1.15  import com.sun.tools.javac.util.Context;
    1.16 +import com.sun.tools.javac.util.Options;
    1.17  
    1.18  public class T6838467 {
    1.19      boolean fileSystemIsCaseSignificant = !new File("a").equals(new File("A"));
    1.20 @@ -176,33 +178,13 @@
    1.21          return fm;
    1.22      }
    1.23  
    1.24 -    JavacFileManager createFileManager(boolean useJavaUtilZip) {
    1.25 -        // javac should really not be using system properties like this
    1.26 -        // -- it should really be using (hidden) options -- but until then
    1.27 -        // take care to leave system properties as we find them, so as not
    1.28 -        // to adversely affect other tests that might follow.
    1.29 -        String prev = System.getProperty("useJavaUtilZip");
    1.30 -        boolean resetProperties = false;
    1.31 -        try {
    1.32 -            if (useJavaUtilZip) {
    1.33 -                System.setProperty("useJavaUtilZip", "true");
    1.34 -                resetProperties = true;
    1.35 -            } else if (System.getProperty("useJavaUtilZip") != null) {
    1.36 -                System.getProperties().remove("useJavaUtilZip");
    1.37 -                resetProperties = true;
    1.38 -            }
    1.39 -
    1.40 -            Context c = new Context();
    1.41 -            return new JavacFileManager(c, false, null);
    1.42 -        } finally {
    1.43 -            if (resetProperties) {
    1.44 -                if (prev == null) {
    1.45 -                    System.getProperties().remove("useJavaUtilZip");
    1.46 -                } else {
    1.47 -                    System.setProperty("useJavaUtilZip", prev);
    1.48 -                }
    1.49 -            }
    1.50 +    JavacFileManager createFileManager(boolean useOptimedZipIndex) {
    1.51 +        Context ctx = new Context();
    1.52 +        if (useOptimedZipIndex) {
    1.53 +            Options options = Options.instance(ctx);
    1.54 +            options.put("useOptimizedZip", "true");
    1.55          }
    1.56 +        return new JavacFileManager(ctx, false, null);
    1.57      }
    1.58  
    1.59      // create a directory containing a given set of paths

mercurial