001/* 002 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. 008 * 009 * This code is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 012 * version 2 for more details (a copy is included in the LICENSE file that 013 * accompanied this code). 014 * 015 * You should have received a copy of the GNU General Public License version 016 * 2 along with this work; if not, write to the Free Software Foundation, 017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 018 * 019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 020 * or visit www.oracle.com if you need additional information or have any 021 * questions. 022 */ 023/* 024 */ 025package com.oracle.graal.jtt.lang; 026 027import java.util.*; 028 029import org.junit.*; 030 031import com.oracle.graal.jtt.*; 032 033public final class ProcessEnvironment_init extends JTTTest { 034 035 private static HashMap<Object, Object> theEnvironment; 036 public static Map<Object, Object> theUnmodifiableEnvironment; 037 038 public static int test(int v) { 039 040 byte[][] environ = environ(); 041 theEnvironment = new HashMap<>(environ.length / 2 + 3); 042 043 for (int i = environ.length - 1; i > 0; i -= 2) { 044 theEnvironment.put(Variable.valueOf(environ[i - 1]), Value.valueOf(environ[i])); 045 } 046 047 theUnmodifiableEnvironment = Collections.unmodifiableMap(new StringEnvironment(theEnvironment)); 048 049 return v; 050 } 051 052 @SuppressWarnings("serial") 053 private static final class StringEnvironment extends HashMap<Object, Object> { 054 055 @SuppressWarnings("unused") 056 public StringEnvironment(HashMap<Object, Object> theenvironment) { 057 } 058 } 059 060 private static final class Variable { 061 062 @SuppressWarnings("unused") 063 public static Object valueOf(byte[] bs) { 064 return new Object(); 065 } 066 } 067 068 private static final class Value { 069 070 @SuppressWarnings("unused") 071 public static Object valueOf(byte[] bs) { 072 return new Object(); 073 } 074 } 075 076 private static byte[][] environ() { 077 return new byte[3][3]; 078 } 079 080 @Test 081 public void run0() throws Throwable { 082 runTest("test", 7); 083 } 084 085}