id
int64 | file_name
string | file_path
string | content
string | size
int64 | language
string | extension
string | total_lines
int64 | avg_line_length
float64 | max_line_length
int64 | alphanum_fraction
float64 | repo_name
string | repo_stars
int64 | repo_forks
int64 | repo_open_issues
int64 | repo_license
string | repo_extraction_date
string | exact_duplicates_redpajama
bool | near_duplicates_redpajama
bool | exact_duplicates_githubcode
bool | exact_duplicates_stackv2
bool | exact_duplicates_stackv1
bool | near_duplicates_githubcode
bool | near_duplicates_stackv1
bool | near_duplicates_stackv2
bool | length
int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,217,556
|
StatsThread.java
|
iskoda_Bubing-crawler-BUT/src/it/unimi/di/law/bubing/frontier/StatsThread.java
|
package it.unimi.di.law.bubing.frontier;
/*
* Copyright (C) 2012-2013 Paolo Boldi, Massimo Santini, and Sebastiano Vigna
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
import it.unimi.dsi.Util;
import it.unimi.dsi.bits.Fast;
import it.unimi.dsi.logging.ProgressLogger;
import it.unimi.dsi.stat.SummaryStats;
import java.util.Arrays;
import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLongArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
//RELEASE-STATUS: DIST
/** A class isolating a number of {@link ProgressLogger} instances keeping track of a number of
* quantities of interest related to the {@link Distributor}, e.g.,
* {@linkplain #requestLogger requests}, {@linkplain #transferredBytesLogger transferred byets}, etc. */
public final class StatsThread implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger( StatsThread.class );
/** A reference to the frontier. */
private final Frontier frontier;
/** A reference to the distributor. */
private final Distributor distributor;
/** A global progress logger, measuring the number of completed requests. */
public final ProgressLogger requestLogger;
/** A global progress logger, measuring the number of non-duplicate resources actually stored. */
public final ProgressLogger resourceLogger;
/** A global progress logger, measuring the number of transferred bytes. */
public final ProgressLogger transferredBytesLogger;
/** A global progress logger, counting the URLs received from other agents. */
public final ProgressLogger receivedURLsLogger;
/** A variable used for exponentially-binned distribution of visit state sizes. */
public volatile int dist[] = new int[ 0 ];
/** The number of path+queries living in an unresolved visit state. */
public volatile long unresolved = 0;
/** The number of path+queries living in a broken visit state. */
public volatile long brokenPathQueryCount = 0;
/** A variable accumulating statistics about the size (in visit states) of {@linkplain WorkbenchEntry workbench entries}. */
public volatile SummaryStats entrySummaryStats;
/** The number of resolved visit states. */
public volatile long resolvedVisitStates;
/** The number of broken visit states on the workbench. */
public volatile long brokenVisitStatesOnWorkbench;
/** Creates the thread.
*
* @param frontier the frontier instantiating the thread.
* @param distributor the distributor used.
*/
public StatsThread( final Frontier frontier, final Distributor distributor ) {
this.frontier = frontier;
this.distributor = distributor;
requestLogger = new ProgressLogger( LOGGER, Long.MAX_VALUE, TimeUnit.MILLISECONDS, "requests" );
requestLogger.displayFreeMemory = requestLogger.displayLocalSpeed = true;
requestLogger.speedTimeUnit = TimeUnit.SECONDS;
requestLogger.itemTimeUnit = TimeUnit.MILLISECONDS;
resourceLogger = new ProgressLogger( LOGGER, Long.MAX_VALUE, TimeUnit.MILLISECONDS, "resources" );
resourceLogger.displayLocalSpeed = true;
resourceLogger.speedTimeUnit = TimeUnit.SECONDS;
resourceLogger.itemTimeUnit = TimeUnit.MILLISECONDS;
transferredBytesLogger = new ProgressLogger( LOGGER, Long.MAX_VALUE, TimeUnit.MILLISECONDS, "bytes" );
transferredBytesLogger.displayLocalSpeed = true;
transferredBytesLogger.speedTimeUnit = TimeUnit.SECONDS;
transferredBytesLogger.itemTimeUnit = TimeUnit.NANOSECONDS;
receivedURLsLogger = new ProgressLogger( LOGGER, Long.MAX_VALUE, TimeUnit.MILLISECONDS, "receivedURLs" );
receivedURLsLogger.displayLocalSpeed = true;
receivedURLsLogger.speedTimeUnit = TimeUnit.SECONDS;
}
/** Starst all progress loggers.
*
* @param previousCrawlDuration the duration of the previous crawl, or zero for a new crawl.
*/
public void start( long previousCrawlDuration ) {
requestLogger.start( previousCrawlDuration );
resourceLogger.start( previousCrawlDuration );
transferredBytesLogger.start( previousCrawlDuration );
receivedURLsLogger.start( previousCrawlDuration );
}
/** Returns an integer array as a string, but does not print trailing zeroes.
*
* @param a an array.
* @return {@link Arrays#toString()} of {@code a}, but without trailing zeroes.
*/
public static String toString( final int[] a ) {
int i;
for( i = a.length; i-- != 0; ) if ( a[ i ] != 0 ) break;
return Arrays.toString( Arrays.copyOfRange( a, 0, i + 1 ) );
}
/** Returns an {@link AtomicLongArray} array as a string, but does not print trailing zeroes.
*
* @param a an atomic array.
* @return {@link Arrays#toString(long[])} of {@code a}, but without trailing zeroes.
*/
public static String toString( final AtomicLongArray a ) {
int i;
for( i = a.length(); i-- != 0; ) if ( a.get( i ) != 0 ) break;
final long[] b = new long[ i + 1 ];
for( ++i; i-- != 0; ) b[ i ] = a.get( i );
return Arrays.toString( b );
}
/** Emits the statistics. */
public void emit() {
requestLogger.setAndDisplay( frontier.fetchedResources.get() + frontier.fetchedRobots.get() );
final long duplicates = frontier.duplicates.get();
final long archetypes = frontier.archetypes();
resourceLogger.setAndDisplay( archetypes + duplicates );
transferredBytesLogger.setAndDisplay( frontier.transferredBytes.get() );
receivedURLsLogger.setAndDisplay( frontier.numberOfReceivedURLs.get() );
LOGGER.info( "Duplicates: " + Util.format( duplicates ) + " (" + Util.format( 100.0 * duplicates / ( duplicates + archetypes ) ) + "%)" );
LOGGER.info( "Archetypes 1XX/2XX/3XX/4XX/5XX/Other: "
+ Util.format( frontier.archetypesStatus[ 1 ].get() ) + "/"
+ Util.format( frontier.archetypesStatus[ 2 ].get() ) + "/"
+ Util.format( frontier.archetypesStatus[ 3 ].get() ) + "/"
+ Util.format( frontier.archetypesStatus[ 4 ].get() ) + "/"
+ Util.format( frontier.archetypesStatus[ 5 ].get() ) + "/"
+ Util.format( frontier.archetypesStatus[ 0 ].get() ) );
LOGGER.info( "Outdegree stats: " + frontier.outdegree.toString() );
LOGGER.info( "External outdegree stats: " + frontier.externalOutdegree.toString() );
LOGGER.info( "Archetype content-length stats: " + frontier.contentLength.toString() );
LOGGER.info( "Archetypes text/image/application/other: "
+ Util.format( frontier.contentTypeText.get() ) + "/"
+ Util.format( frontier.contentTypeImage.get() ) + "/"
+ Util.format( frontier.contentTypeApplication.get() ) + "/"
+ Util.format( frontier.contentTypeOthers.get() ) );
LOGGER.info( "Ready URLs: " + Util.format( frontier.readyURLs.size64() ) );
LOGGER.info( "FetchingThread waits: " + frontier.fetchingThreadWaits.get() + "; total wait time: " + frontier.fetchingThreadWaitingTimeSum.get() );
frontier.resetFetchingThreadsWaitingStats();
}
private boolean checkState() {
for( VisitState visitState: distributor.schemeAuthority2VisitState.visitStates() )
if ( visitState != null )
synchronized ( visitState ) {
if ( visitState.workbenchEntry == null && visitState.acquired ) LOGGER.error( "Acquired visit state with empty workbench entry: " + visitState );
if ( visitState.workbenchEntry == null && visitState.nextFetch != Long.MAX_VALUE && visitState.isEmpty() ) LOGGER.error( "Empty visit state with empty workbench entry: " + visitState );
//if ( ! visitState.acquired && frontier.virtualizer.count( visitState ) > 0 && visitState.isEmpty() && visitState.nextFetch != Long.MAX_VALUE && ! frontier.refill.contains( visitState ) ) LOGGER.error( "Empty visit state with URLs on disk not scheduled for refill (not a problem if it doesn't appear again): " + visitState );
}
long c = 0;
for( WorkbenchEntry workbenchEntry: frontier.workbench.workbenchEntries() ) {
if ( workbenchEntry != null ) {
synchronized ( workbenchEntry ) {
if ( workbenchEntry.isEntirelyBroken() ) c++;
}
}
}
final long broken = frontier.workbench.broken.get();
if ( Math.abs( c - broken ) > Math.max( 4 , .1 * ( c + 1 ) ) ) LOGGER.error( "Broken count (counter): " + broken + " Broken count (counted): " + c + " (not a problem if it doesn't appear often)" );
return true;
}
@Override
public void run() {
frontier.workbenchSizeInPathQueries = frontier.rc.workbenchMaxByteSize / Math.max( 1, frontier.weightOfpathQueriesInQueues.get() / ( 1 + frontier.pathQueriesInQueues.get() ) );
LOGGER.info( "There are now " + frontier.pathQueriesInQueues.get() + " URLs in queues (" + Util.formatSize( frontier.weightOfpathQueriesInQueues.get() ) + "B, " + Util.format( 100.0 * frontier.weightOfpathQueriesInQueues.get() / frontier.rc.workbenchMaxByteSize ) + "%)" );
double totalSpeed = 0;
long nonEmptyResolvedVisitStates = 0;
final int dist[] = new int[ 32 ];
final int distUnresolved[] = new int[ 32 ];
final int distBroken[] = new int[ 32 ];
long resolvedVisitStates = 0, brokenVisitStatesOnWorkbench = 0, unresolved = 0, brokenPathQueryCount = 0;
for( VisitState visitState: distributor.schemeAuthority2VisitState.visitStates() ) { // We own the map.
if ( visitState == null ) continue;
final int size = visitState.size();
if ( visitState.workbenchEntry != null ) {
resolvedVisitStates++;
if ( visitState.lastExceptionClass != null ) {
brokenVisitStatesOnWorkbench++;
distBroken[ Fast.mostSignificantBit( size ) + 1 ]++;
brokenPathQueryCount += size;
}
else {
dist[ Fast.mostSignificantBit( size ) + 1 ]++;
if ( size != 0 ) nonEmptyResolvedVisitStates++;
}
}
else {
distUnresolved[ Fast.mostSignificantBit( size ) + 1 ]++;
unresolved += size;
}
}
this.dist = dist;
this.unresolved = unresolved;
this.brokenPathQueryCount = brokenPathQueryCount;
LOGGER.info( "Queue dist: " + toString( dist ) + " (unresolved: " + unresolved + ", broken: " + brokenPathQueryCount + ")" );
LOGGER.info( "BrokenQueue dist: " + toString( distBroken ) );
LOGGER.info( "UnresolvedQueue dist: " + toString( distUnresolved ) );
if ( nonEmptyResolvedVisitStates != 0 ) frontier.averageSpeed = totalSpeed / nonEmptyResolvedVisitStates;
assert checkState();
final SummaryStats entrySummaryStats = new SummaryStats();
for( Iterator<WorkbenchEntry> iterator = frontier.workbench.iterator(); iterator.hasNext(); ) { // Concurrency-safe iterator by documentation.
final int numVisitStates = iterator.next().size(); // Synchronized method.
if ( numVisitStates != 0 ) entrySummaryStats.add( numVisitStates ); // Might be zero by asynchronous modifications.
}
this.entrySummaryStats = entrySummaryStats;
this.resolvedVisitStates = resolvedVisitStates;
this.brokenVisitStatesOnWorkbench = brokenVisitStatesOnWorkbench;
LOGGER.info( "Entry stats: " + entrySummaryStats );
LOGGER.info( "Virtualizer stats: " + frontier.virtualizer );
LOGGER.info( "Visit states: " + distributor.schemeAuthority2VisitState.size()
+ "; resolved: " + resolvedVisitStates
+ "; on workbench (IP): " + frontier.workbench.approximatedSize()
+ "; broken on workbench (IP): " + frontier.workbench.broken.get()
+ "; on workbench (S+A): " + (long)entrySummaryStats.sum()
+ "; to do: " + frontier.todo.size()
+ "; active: " + ( frontier.rc.fetchingThreads - frontier.results.size() )
+ "; ready to parse: " + frontier.results.size()
+ "; unknown hosts: " + frontier.unknownHosts.size()
+ "; broken: " + frontier.brokenVisitStates.get() + " (" + brokenVisitStatesOnWorkbench + " on workbench)"
+ "; waiting: " + frontier.newVisitStates.size()
+ "; on disk: " + frontier.virtualizer.onDisk() );
LOGGER.info( "Speed dist: " + toString( frontier.speedDist ) );
for( int i = frontier.speedDist.length(); i-- != 0; ) frontier.speedDist.set( i, 0 ); // Cleanup
LOGGER.info( "Cache hits: " + frontier.urlCache.hits() + " misses: " + frontier.urlCache.misses() );
distributor.lastHighCostStat = System.currentTimeMillis();
}
/** Returns the number of visit states on disk.
*
* @return the number of visit states on disk.
*/
public long getVisitStatesOnDisk(){
return frontier.virtualizer.onDisk();
}
/** Returns the overall number of visit states.
*
* @return the overall number of visit states.
*/
public int getVisitStates(){
return distributor.schemeAuthority2VisitState.size();
}
/** Terminates the statistics, {@linkplain ProgressLogger#done closing} all the progress loggers. */
public void done() {
requestLogger.done();
resourceLogger.done();
transferredBytesLogger.done();
receivedURLsLogger.done();
}
}
| 13,215
|
Java
|
.java
| 249
| 49.654618
| 331
| 0.727484
|
iskoda/Bubing-crawler-BUT
| 2
| 1
| 0
|
LGPL-3.0
|
9/5/2024, 12:06:17 AM (Europe/Amsterdam)
| false
| true
| true
| true
| true
| true
| true
| true
| 13,215
|
13,788
|
package-info.java
|
checkstyle_checkstyle/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/missingjavadocpackage/nojavadoc/annotation/blockcomment/package-info.java
|
/*
MissingJavadocPackage
*/
/*
* Some comment
*/
@Nullable
package com.puppycrawl.tools.checkstyle.checks // violation
.javadoc.missingjavadocpackage.nojavadoc.annotation.blockcomment;
import javax.annotation.Nullable;
| 234
|
Java
|
.java
| 10
| 21
| 73
| 0.812785
|
checkstyle/checkstyle
| 8,277
| 3,649
| 906
|
LGPL-2.1
|
9/4/2024, 7:04:55 PM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| false
| true
| true
| 234
|
4,256,153
|
RequestParam.java
|
rockleeprc_sourcecode/spring-framework/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestParam.java
|
/*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.bind.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Map;
import org.springframework.core.annotation.AliasFor;
/**
* Annotation which indicates that a method parameter should be bound to a web
* request parameter.
*
* <p>Supported for annotated handler methods in Spring MVC and Spring WebFlux
* as follows:
* <ul>
* <li>In Spring MVC, "request parameters" map to query parameters, form data,
* and parts in multipart requests. This is because the Servlet API combines
* query parameters and form data into a single map called "parameters", and
* that includes automatic parsing of the request body.
* <li>In Spring WebFlux, "request parameters" map to query parameters only.
* To work with all 3, query, form data, and multipart data, you can use data
* binding to a command object annotated with {@link ModelAttribute}.
* </ul>
*
* <p>If the method parameter type is {@link Map} and a request parameter name
* is specified, then the request parameter value is converted to a {@link Map}
* assuming an appropriate conversion strategy is available.
*
* <p>If the method parameter is {@link java.util.Map Map<String, String>} or
* {@link org.springframework.util.MultiValueMap MultiValueMap<String, String>}
* and a parameter name is not specified, then the map parameter is populated
* with all request parameter names and values.
*
* @author Arjen Poutsma
* @author Juergen Hoeller
* @author Sam Brannen
* @since 2.5
* @see RequestMapping
* @see RequestHeader
* @see CookieValue
*/
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RequestParam {
/**
* Alias for {@link #name}.
*/
@AliasFor("name")
String value() default "";
/**
* The name of the request parameter to bind to.
* @since 4.2
*/
@AliasFor("value")
String name() default "";
/**
* Whether the parameter is required.
* <p>Defaults to {@code true}, leading to an exception being thrown
* if the parameter is missing in the request. Switch this to
* {@code false} if you prefer a {@code null} value if the parameter is
* not present in the request.
* <p>Alternatively, provide a {@link #defaultValue}, which implicitly
* sets this flag to {@code false}.
*/
boolean required() default true;
/**
* The default value to use as a fallback when the request parameter is
* not provided or has an empty value.
* <p>Supplying a default value implicitly sets {@link #required} to
* {@code false}.
*/
String defaultValue() default ValueConstants.DEFAULT_NONE;
}
| 3,395
|
Java
|
.java
| 89
| 36.011236
| 85
| 0.754625
|
rockleeprc/sourcecode
| 2
| 2
| 0
|
GPL-3.0
|
9/5/2024, 12:07:03 AM (Europe/Amsterdam)
| false
| true
| true
| true
| true
| true
| true
| true
| 3,395
|
4,015,831
|
ClassNotFoundExceptionParser.java
|
OpenNTF_FindBug-for-Domino-Designer/findBugsEclipsePlugin/src/edu/umd/cs/findbugs/ba/ClassNotFoundExceptionParser.java
|
/*
* Bytecode Analysis Framework
* Copyright (C) 2003,2004 University of Maryland
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package edu.umd.cs.findbugs.ba;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import edu.umd.cs.findbugs.classfile.ClassDescriptor;
import edu.umd.cs.findbugs.classfile.DescriptorFactory;
import edu.umd.cs.findbugs.classfile.ResourceNotFoundException;
import edu.umd.cs.findbugs.internalAnnotations.DottedClassName;
import edu.umd.cs.findbugs.util.ClassName;
/**
* Parse the detail message in a ClassNotFoundException to extract the name of
* the missing class. Unfortunately, this information is not directly available
* from the exception object. So, this class parses the detail message in
* several common formats (such as the format used by BCEL).
*
* @author David Hovemeyer
*/
public class ClassNotFoundExceptionParser {
// BCEL reports missing classes in this format
private static final Pattern BCEL_MISSING_CLASS_PATTERN = Pattern.compile("^.*while looking for class ([^:]*):.*$");
// edu.umd.cs.findbugs.ba.type.TypeRepository
// and edu.umd.cs.findbugs.ba.ch.Subtypes2 uses this format
private static final Pattern TYPE_REPOSITORY_MISSING_CLASS_PATTERN = Pattern.compile("^Class ([^ ]*) cannot be resolved.*$");
private static final Pattern[] patternList;
static {
ArrayList<Pattern> list = new ArrayList<Pattern>();
list.add(BCEL_MISSING_CLASS_PATTERN);
list.add(TYPE_REPOSITORY_MISSING_CLASS_PATTERN);
patternList = list.toArray(new Pattern[list.size()]);
}
/**
* Get the name of the missing class from a ClassNotFoundException.
*
* @param ex
* the ClassNotFoundException
* @return the name of the missing class, or null if we couldn't figure out
* the class name
*/
public static @DottedClassName
String getMissingClassName(ClassNotFoundException ex) {
// If the exception has a ResourceNotFoundException as the cause,
// then we have an easy answer.
Throwable cause = ex.getCause();
if (cause instanceof ResourceNotFoundException) {
String resourceName = ((ResourceNotFoundException) cause).getResourceName();
if (resourceName != null) {
ClassDescriptor classDesc = DescriptorFactory.createClassDescriptorFromResourceName(resourceName);
return classDesc.toDottedClassName();
}
}
if (ex.getMessage() == null) {
return null;
}
// Try the regular expression patterns to parse the class name
// from the exception message.
for (Pattern pattern : patternList) {
Matcher matcher = pattern.matcher(ex.getMessage());
if (matcher.matches()) {
String className = matcher.group(1);
ClassName.assertIsDotted(className);
return className;
}
}
return null;
}
}
// vim:ts=4
| 3,762
|
Java
|
.java
| 85
| 38.411765
| 129
| 0.705786
|
OpenNTF/FindBug-for-Domino-Designer
| 2
| 0
| 5
|
LGPL-3.0
|
9/4/2024, 11:59:57 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 3,762
|
3,692,639
|
StateChange.java
|
microsoft_mariadb-connector-j/src/main/java/org/mariadb/jdbc/internal/util/constant/StateChange.java
|
/*
*
* MariaDB Client for Java
*
* Copyright (c) 2012-2014 Monty Program Ab.
* Copyright (c) 2015-2020 MariaDB Corporation Ab.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with this library; if not, write to Monty Program Ab [email protected].
*
* This particular MariaDB Client for Java file is work
* derived from a Drizzle-JDBC. Drizzle-JDBC file which is covered by subject to
* the following copyright and notice provisions:
*
* Copyright (c) 2009-2011, Marcus Eriksson
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of the driver nor the names of its contributors may not be
* used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
*/
package org.mariadb.jdbc.internal.util.constant;
public class StateChange {
public static final short SESSION_TRACK_SYSTEM_VARIABLES = 0;
public static final short SESSION_TRACK_SCHEMA = 1;
public static final short SESSION_TRACK_STATE_CHANGE = 2;
public static final short SESSION_TRACK_GTIDS = 3;
public static final short SESSION_TRACK_TRANSACTION_CHARACTERISTICS = 4;
public static final short SESSION_TRACK_TRANSACTION_STATE = 5;
}
| 2,994
|
Java
|
.java
| 60
| 47.816667
| 89
| 0.785739
|
microsoft/mariadb-connector-j
| 3
| 9
| 2
|
LGPL-2.1
|
9/4/2024, 11:38:49 PM (Europe/Amsterdam)
| false
| false
| false
| true
| false
| true
| true
| true
| 2,994
|
1,317,626
|
A_test3_out.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/AbstractField/can/A_test3_out.java
|
//abstract and make private
package p;
class A{
private int f;
void m(){
int g= getF();
}
public int getF(){
return f;
}
}
class B{
int m(){
A a= new A();
return a.getF();
}
}
| 190
|
Java
|
.java
| 17
| 9.352941
| 27
| 0.614943
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 190
|
4,490,939
|
ForgeBlockModelRenderer.java
|
PatchworkMC_crabwork/src/main/forge/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java
|
/*
* Minecraft Forge, Patchwork Project
* Copyright (c) 2016-2020, 2019-2020
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.model.pipeline;
import java.util.List;
import java.util.Random;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BlockModelRenderer;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.common.ForgeConfig;
public class ForgeBlockModelRenderer extends BlockModelRenderer
{
private final ThreadLocal<VertexLighterFlat> lighterFlat;
private final ThreadLocal<VertexLighterSmoothAo> lighterSmooth;
private final ThreadLocal<VertexBufferConsumer> consumerFlat = ThreadLocal.withInitial(VertexBufferConsumer::new);
private final ThreadLocal<VertexBufferConsumer> consumerSmooth = ThreadLocal.withInitial(VertexBufferConsumer::new);
public ForgeBlockModelRenderer(BlockColors colors)
{
super(colors);
lighterFlat = ThreadLocal.withInitial(() -> new VertexLighterFlat(colors));
lighterSmooth = ThreadLocal.withInitial(() -> new VertexLighterSmoothAo(colors));
}
@Override
public boolean renderModelFlat(IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
{
if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get())
{
VertexBufferConsumer consumer = consumerFlat.get();
consumer.setBuffer(buffer);
VertexLighterFlat lighter = lighterFlat.get();
lighter.setParent(consumer);
lighter.setTransform(matrixStack.getLast());
return render(lighter, world, model, state, pos, matrixStack, checkSides, rand, seed, modelData);
}
else
{
return super.renderModelFlat(world, model, state, pos, matrixStack, buffer, checkSides, rand, seed, combinedOverlayIn, modelData);
}
}
@Override
public boolean renderModelSmooth(IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder buffer, boolean checkSides, Random rand, long seed, int combinedOverlayIn, IModelData modelData)
{
if(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get())
{
VertexBufferConsumer consumer = consumerSmooth.get();
consumer.setBuffer(buffer);
VertexLighterSmoothAo lighter = lighterSmooth.get();
lighter.setParent(consumer);
lighter.setTransform(matrixStack.getLast());
return render(lighter, world, model, state, pos, matrixStack, checkSides, rand, seed, modelData);
}
else
{
return super.renderModelSmooth(world, model, state, pos, matrixStack, buffer, checkSides, rand, seed, combinedOverlayIn, modelData);
}
}
public static boolean render(VertexLighterFlat lighter, IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, boolean checkSides, Random rand, long seed, IModelData modelData)
{
lighter.setWorld(world);
lighter.setState(state);
lighter.setBlockPos(pos);
boolean empty = true;
rand.setSeed(seed);
List<BakedQuad> quads = model.getQuads(state, null, rand, modelData);
if(!quads.isEmpty())
{
lighter.updateBlockInfo();
empty = false;
for(BakedQuad quad : quads)
{
quad.pipe(lighter);
}
}
for(Direction side : Direction.values())
{
rand.setSeed(seed);
quads = model.getQuads(state, side, rand, modelData);
if(!quads.isEmpty())
{
if(!checkSides || Block.shouldSideBeRendered(state, world, pos, side))
{
if(empty) lighter.updateBlockInfo();
empty = false;
for(BakedQuad quad : quads)
{
quad.pipe(lighter);
}
}
}
}
lighter.resetBlockInfo();
return !empty;
}
}
| 5,391
|
Java
|
.java
| 118
| 37.830508
| 251
| 0.700627
|
PatchworkMC/crabwork
| 2
| 0
| 0
|
LGPL-2.1
|
9/5/2024, 12:14:53 AM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| false
| true
| true
| 5,391
|
3,469,075
|
PDFRedundanceTracker.java
|
phuseman_r2cat/org/freehep/graphicsio/pdf/PDFRedundanceTracker.java
|
// Copyright 2001 freehep
package org.freehep.graphicsio.pdf;
import java.io.IOException;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Vector;
/**
* This class keeps track of all kinds of objects written to a pdf file and
* avoids to write them several times instead of referencing the same object
* several times. Right now only encoding tables are supported.
*
* An implementation for images and paint would be possible.
*
* @author Simon Fischer
* @version $Id: PDFRedundanceTracker.java 8584 2006-08-10 23:06:37Z duns $
*/
public class PDFRedundanceTracker {
/**
* To be implemented by Writers which write objects that may already have
* been written.
*/
public interface Writer {
public void writeObject(Object o, PDFRef reference, PDFWriter pdf)
throws IOException;
}
private class Entry {
private static final String REF_PREFIX = "PDF_RTObj";
private Object object;
private Writer writer;
private boolean written;
private PDFRef reference;
private Object groupID;
private Entry(Object o, Object groupID, Writer w) {
this.object = o;
this.groupID = groupID;
this.writer = w;
this.written = false;
this.reference = pdf.ref(REF_PREFIX + (refCount++));
}
}
private static int refCount = 1;
private PDFWriter pdf;
private Map objects;
private Vector orderedObjects; // to keep order
public PDFRedundanceTracker(PDFWriter pdf) {
this.pdf = pdf;
objects = new Hashtable();
orderedObjects = new Vector();
}
/**
* Returns a reference that points to <tt>object</tt>. When this method
* is called several times for the same object (according to its hash code)
* the same reference is returned. When <tt>writeAll()</tt> is called the
* writer's <tt>writeObject()</tt> method will be called once with
* <tt>object</tt> as argument.<br>
* The groupID is only used for <tt>getGroup()</tt>
*/
public PDFRef getReference(Object object, Object groupID, Writer writer) {
Object o = objects.get(object);
if (o != null) {
return ((Entry) o).reference;
} else {
Entry entry = new Entry(object, groupID, writer);
objects.put(object, entry);
orderedObjects.add(entry);
return entry.reference;
}
}
public PDFRef getReference(Object object, Writer writer) {
return getReference(object, null, writer);
}
/**
* Writes all objects that are not yet written. If the method is called
* several times then each times only the new objects are written.
*/
public void writeAll() {
Iterator i = orderedObjects.iterator();
while (i.hasNext()) {
Entry entry = (Entry) i.next();
if (!entry.written) {
try {
// System.out.println("PDFRT: Writing: " + entry.object);
entry.writer
.writeObject(entry.object, entry.reference, pdf);
entry.written = true;
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/** Returns all objects belonging to a particular group. */
public Collection getGroup(Object groupID) {
Collection result = new LinkedList();
Iterator i = orderedObjects.iterator();
while (i.hasNext()) {
Entry entry = (Entry) i.next();
if (groupID.equals(entry.groupID)) {
result.add(entry.object);
}
}
return result;
}
}
| 3,866
|
Java
|
.java
| 107
| 28
| 79
| 0.618182
|
phuseman/r2cat
| 3
| 1
| 1
|
GPL-3.0
|
9/4/2024, 11:29:44 PM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| false
| true
| 3,866
|
1,316,316
|
A.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/testConstant80/out/A.java
|
package p;
class A implements I {
}
class Test{
void f(I a){
int i= a.X;
}
}
| 80
|
Java
|
.java
| 8
| 8.625
| 22
| 0.643836
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 80
|
4,315,733
|
JSObject.java
|
hzio_OpenJDK10/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java
|
/*
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package netscape.javascript;
import jdk.internal.netscape.javascript.spi.JSObjectProvider;
import java.applet.Applet;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Iterator;
import java.util.ServiceLoader;
/**
* <p>
* Allows Java code to manipulate JavaScript objects.
* </p>
*
* <p>
* When a JavaScript object is passed or returned to Java code, it
* is wrapped in an instance of {@code JSObject}. When a
* {@code JSObject} instance is passed to the JavaScript engine,
* it is unwrapped back to its original JavaScript object. The
* {@code JSObject} class provides a way to invoke JavaScript
* methods and examine JavaScript properties.
* </p>
*
* <p> Any data returned from the JavaScript engine to Java is
* converted to Java data types. Certain data passed to the JavaScript
* engine is converted to JavaScript data types.
* </p>
*
*/
@SuppressWarnings("deprecation")
public abstract class JSObject {
/**
* Constructs a new JSObject. Users should neither call this method nor
* subclass JSObject.
*/
protected JSObject() {
}
/**
* Calls a JavaScript method. Equivalent to
* "this.methodName(args[0], args[1], ...)" in JavaScript.
*
* @param methodName The name of the JavaScript method to be invoked.
* @param args the Java objects passed as arguments to the method.
* @return Result of the method.
* @throws JSException when an error is reported from the browser or
* JavaScript engine.
*/
public abstract Object call(String methodName, Object... args) throws JSException;
/**
* Evaluates a JavaScript expression. The expression is a string of
* JavaScript source code which will be evaluated in the context given by
* "this".
*
* @param s The JavaScript expression.
* @return Result of the JavaScript evaluation.
* @throws JSException when an error is reported from the browser or
* JavaScript engine.
*/
public abstract Object eval(String s) throws JSException;
/**
* Retrieves a named member of a JavaScript object. Equivalent to
* "this.name" in JavaScript.
*
* @param name The name of the JavaScript property to be accessed.
* @return The value of the propery.
* @throws JSException when an error is reported from the browser or
* JavaScript engine.
*/
public abstract Object getMember(String name) throws JSException;
/**
* Sets a named member of a JavaScript object. Equivalent to
* "this.name = value" in JavaScript.
*
* @param name The name of the JavaScript property to be accessed.
* @param value The value of the propery.
* @throws JSException when an error is reported from the browser or
* JavaScript engine.
*/
public abstract void setMember(String name, Object value) throws JSException;
/**
* Removes a named member of a JavaScript object. Equivalent
* to "delete this.name" in JavaScript.
*
* @param name The name of the JavaScript property to be removed.
* @throws JSException when an error is reported from the browser or
* JavaScript engine.
*/
public abstract void removeMember(String name) throws JSException;
/**
* Retrieves an indexed member of a JavaScript object. Equivalent to
* "this[index]" in JavaScript.
*
* @param index The index of the array to be accessed.
* @return The value of the indexed member.
* @throws JSException when an error is reported from the browser or
* JavaScript engine.
*/
public abstract Object getSlot(int index) throws JSException;
/**
* Sets an indexed member of a JavaScript object. Equivalent to
* "this[index] = value" in JavaScript.
*
* @param index The index of the array to be accessed.
* @param value The value to set
* @throws JSException when an error is reported from the browser or
* JavaScript engine.
*/
public abstract void setSlot(int index, Object value) throws JSException;
/**
* Returns a JSObject for the window containing the given applet. This
* method only works when the Java code is running in a browser as an
* applet. The object returned may be used to access the HTML DOM directly.
*
* @param applet The applet.
* @return JSObject representing the window containing the given applet or
* {@code null} if we are not connected to a browser.
* @throws JSException when an error is reported from the browser or
* JavaScript engine or if applet is {@code null}
*
* @deprecated The Applet API is deprecated. See the
* <a href="{@docRoot}/java/applet/package-summary.html">
* java.applet package documentation</a> for further information.
*/
@Deprecated(since = "9")
@SuppressWarnings("exports")
public static JSObject getWindow(Applet applet) throws JSException {
return ProviderLoader.callGetWindow(applet);
}
private static class ProviderLoader {
private static final JSObjectProvider provider;
static {
provider = AccessController.doPrivileged(
new PrivilegedAction<>() {
@Override
public JSObjectProvider run() {
Iterator<JSObjectProvider> providers =
ServiceLoader.loadInstalled(JSObjectProvider.class).iterator();
if (providers.hasNext()) {
return providers.next();
}
return null;
}
}
);
}
private static JSObject callGetWindow(Applet applet) {
if (provider != null) {
return provider.getWindow(applet);
}
return null;
}
}
}
| 7,147
|
Java
|
.java
| 175
| 34.748571
| 91
| 0.686359
|
hzio/OpenJDK10
| 2
| 4
| 0
|
GPL-2.0
|
9/5/2024, 12:08:58 AM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 7,147
|
1,318,949
|
A_test453.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/try_out/A_test453.java
|
package try_out;
import java.io.IOException;
public class A_test453 {
public void foo() {
extracted();
}
protected void extracted() {
/*[*/try {
g();
} catch (Exception e) {
}/*]*/
}
public void g() throws IOException {
}
}
| 246
|
Java
|
.java
| 15
| 13.933333
| 37
| 0.646018
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 246
|
1,312,868
|
NonEssentialEmptyLibraryContainerFilter.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/navigator/NonEssentialEmptyLibraryContainerFilter.java
|
/*******************************************************************************
* Copyright (c) 2016 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.ui.navigator;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jdt.internal.ui.packageview.PackageFragmentRootContainer;
/**
* The library container filter is a filter used to determine whether library containers are shown
* that are empty or have all children filtered out by other filters.
*/
public class NonEssentialEmptyLibraryContainerFilter extends NonEssentialElementsFilter {
public NonEssentialEmptyLibraryContainerFilter() {
super(null);
}
@Override
protected boolean doSelect(Viewer viewer, Object parent, Object element) {
if (element instanceof PackageFragmentRootContainer) {
if (isApplicable() && viewer instanceof StructuredViewer) {
PackageFragmentRootContainer rootContainer= (PackageFragmentRootContainer) element;
return rootContainer.getChildren().length > 0 ? hasFilteredChildren((StructuredViewer) viewer, rootContainer) : false;
}
}
return true;
}
}
| 1,557
|
Java
|
.java
| 36
| 40.944444
| 122
| 0.717018
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 1,557
|
1,098,850
|
MinecraftServer.java
|
narumii_Niko/src/main/java/net/minecraft/server/MinecraftServer.java
|
package net.minecraft.server;
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListenableFutureTask;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.GameProfileRepository;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.base64.Base64;
import java.awt.GraphicsEnvironment;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Proxy;
import java.security.KeyPair;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Queue;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import javax.imageio.ImageIO;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandResultStats;
import net.minecraft.command.ICommandManager;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.ServerCommandManager;
import net.minecraft.crash.CrashReport;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetworkSystem;
import net.minecraft.network.ServerStatusResponse;
import net.minecraft.network.play.server.S03PacketTimeUpdate;
import net.minecraft.profiler.IPlayerUsage;
import net.minecraft.profiler.PlayerUsageSnooper;
import net.minecraft.profiler.Profiler;
import net.minecraft.server.management.PlayerProfileCache;
import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.IProgressUpdate;
import net.minecraft.util.IThreadListener;
import net.minecraft.util.ITickable;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ReportedException;
import net.minecraft.util.Util;
import net.minecraft.util.Vec3;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.World;
import net.minecraft.world.WorldManager;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldServerMulti;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.storage.AnvilSaveConverter;
import net.minecraft.world.demo.DemoWorldServer;
import net.minecraft.world.storage.ISaveFormat;
import net.minecraft.world.storage.ISaveHandler;
import net.minecraft.world.storage.WorldInfo;
import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public abstract class MinecraftServer implements Runnable, ICommandSender, IThreadListener, IPlayerUsage
{
private static final Logger logger = LogManager.getLogger();
public static final File USER_CACHE_FILE = new File("usercache.json");
/** Instance of Minecraft Server. */
private static MinecraftServer mcServer;
private final ISaveFormat anvilConverterForAnvilFile;
/** The PlayerUsageSnooper instance. */
private final PlayerUsageSnooper usageSnooper = new PlayerUsageSnooper("server", this, getCurrentTimeMillis());
private final File anvilFile;
private final List<ITickable> playersOnline = Lists.<ITickable>newArrayList();
protected final ICommandManager commandManager;
public final Profiler theProfiler = new Profiler();
private final NetworkSystem networkSystem;
private final ServerStatusResponse statusResponse = new ServerStatusResponse();
private final Random random = new Random();
/** The server's port. */
private int serverPort = -1;
/** The server world instances. */
public WorldServer[] worldServers;
/** The ServerConfigurationManager instance. */
private ServerConfigurationManager serverConfigManager;
/**
* Indicates whether the server is running or not. Set to false to initiate a shutdown.
*/
private boolean serverRunning = true;
/** Indicates to other classes that the server is safely stopped. */
private boolean serverStopped;
/** Incremented every tick. */
private int tickCounter;
protected final Proxy serverProxy;
/**
* The task the server is currently working on(and will output on outputPercentRemaining).
*/
public String currentTask;
/** The percentage of the current task finished so far. */
public int percentDone;
/** True if the server is in online mode. */
private boolean onlineMode;
/** True if the server has animals turned on. */
private boolean canSpawnAnimals;
private boolean canSpawnNPCs;
/** Indicates whether PvP is active on the server or not. */
private boolean pvpEnabled;
/** Determines if flight is allowed or not. */
private boolean allowFlight;
/** The server MOTD string. */
private String motd;
/** Maximum build height. */
private int buildLimit;
private int maxPlayerIdleMinutes = 0;
public final long[] tickTimeArray = new long[100];
/** Stats are [dimension][tick%100] system.nanoTime is stored. */
public long[][] timeOfLastDimensionTick;
private KeyPair serverKeyPair;
/** Username of the server owner (for integrated servers) */
private String serverOwner;
private String folderName;
private String worldName;
private boolean isDemo;
private boolean enableBonusChest;
/**
* If true, there is no need to save chunks or stop the server, because that is already being done.
*/
private boolean worldIsBeingDeleted;
/** The texture pack for the server */
private String resourcePackUrl = "";
private String resourcePackHash = "";
private boolean serverIsRunning;
/**
* Set when warned for "Can't keep up", which triggers again after 15 seconds.
*/
private long timeOfLastWarning;
private String userMessage;
private boolean startProfiling;
private boolean isGamemodeForced;
private final YggdrasilAuthenticationService authService;
private final MinecraftSessionService sessionService;
private long nanoTimeSinceStatusRefresh = 0L;
private final GameProfileRepository profileRepo;
private final PlayerProfileCache profileCache;
protected final Queue < FutureTask<? >> futureTaskQueue = Queues. < FutureTask<? >> newArrayDeque();
private Thread serverThread;
private long currentTime = getCurrentTimeMillis();
public MinecraftServer(Proxy proxy, File workDir)
{
this.serverProxy = proxy;
mcServer = this;
this.anvilFile = null;
this.networkSystem = null;
this.profileCache = new PlayerProfileCache(this, workDir);
this.commandManager = null;
this.anvilConverterForAnvilFile = null;
this.authService = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString());
this.sessionService = this.authService.createMinecraftSessionService();
this.profileRepo = this.authService.createProfileRepository();
}
public MinecraftServer(File workDir, Proxy proxy, File profileCacheDir)
{
this.serverProxy = proxy;
mcServer = this;
this.anvilFile = workDir;
this.networkSystem = new NetworkSystem(this);
this.profileCache = new PlayerProfileCache(this, profileCacheDir);
this.commandManager = this.createNewCommandManager();
this.anvilConverterForAnvilFile = new AnvilSaveConverter(workDir);
this.authService = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString());
this.sessionService = this.authService.createMinecraftSessionService();
this.profileRepo = this.authService.createProfileRepository();
}
protected ServerCommandManager createNewCommandManager()
{
return new ServerCommandManager();
}
/**
* Initialises the server and starts it.
*/
protected abstract boolean startServer() throws IOException;
protected void convertMapIfNeeded(String worldNameIn)
{
if (this.getActiveAnvilConverter().isOldMapFormat(worldNameIn))
{
logger.info("Converting map!");
this.setUserMessage("menu.convertingLevel");
this.getActiveAnvilConverter().convertMapFormat(worldNameIn, new IProgressUpdate()
{
private long startTime = System.currentTimeMillis();
public void displaySavingString(String message)
{
}
public void resetProgressAndMessage(String message)
{
}
public void setLoadingProgress(int progress)
{
if (System.currentTimeMillis() - this.startTime >= 1000L)
{
this.startTime = System.currentTimeMillis();
MinecraftServer.logger.info("Converting... " + progress + "%");
}
}
public void setDoneWorking()
{
}
public void displayLoadingString(String message)
{
}
});
}
}
/**
* Typically "menu.convertingLevel", "menu.loadingLevel" or others.
*/
protected synchronized void setUserMessage(String message)
{
this.userMessage = message;
}
public synchronized String getUserMessage()
{
return this.userMessage;
}
protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_)
{
this.convertMapIfNeeded(p_71247_1_);
this.setUserMessage("menu.loadingLevel");
this.worldServers = new WorldServer[3];
this.timeOfLastDimensionTick = new long[this.worldServers.length][100];
ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true);
this.setResourcePackFromWorld(this.getFolderName(), isavehandler);
WorldInfo worldinfo = isavehandler.loadWorldInfo();
WorldSettings worldsettings;
if (worldinfo == null)
{
if (this.isDemo())
{
worldsettings = DemoWorldServer.demoWorldSettings;
}
else
{
worldsettings = new WorldSettings(seed, this.getGameType(), this.canStructuresSpawn(), this.isHardcore(), type);
worldsettings.setWorldName(p_71247_6_);
if (this.enableBonusChest)
{
worldsettings.enableBonusChest();
}
}
worldinfo = new WorldInfo(worldsettings, p_71247_2_);
}
else
{
worldinfo.setWorldName(p_71247_2_);
worldsettings = new WorldSettings(worldinfo);
}
for (int i = 0; i < this.worldServers.length; ++i)
{
int j = 0;
if (i == 1)
{
j = -1;
}
if (i == 2)
{
j = 1;
}
if (i == 0)
{
if (this.isDemo())
{
this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init();
}
else
{
this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init();
}
this.worldServers[i].initialize(worldsettings);
}
else
{
this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init();
}
this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i]));
if (!this.isSinglePlayer())
{
this.worldServers[i].getWorldInfo().setGameType(this.getGameType());
}
}
this.serverConfigManager.setPlayerManager(this.worldServers);
this.setDifficultyForAllWorlds(this.getDifficulty());
this.initialWorldChunkLoad();
}
protected void initialWorldChunkLoad()
{
int i = 16;
int j = 4;
int k = 192;
int l = 625;
int i1 = 0;
this.setUserMessage("menu.generatingTerrain");
int j1 = 0;
logger.info("Preparing start region for level " + j1);
WorldServer worldserver = this.worldServers[j1];
BlockPos blockpos = worldserver.getSpawnPoint();
long k1 = getCurrentTimeMillis();
for (int l1 = -192; l1 <= 192 && this.isServerRunning(); l1 += 16)
{
for (int i2 = -192; i2 <= 192 && this.isServerRunning(); i2 += 16)
{
long j2 = getCurrentTimeMillis();
if (j2 - k1 > 1000L)
{
this.outputPercentRemaining("Preparing spawn area", i1 * 100 / 625);
k1 = j2;
}
++i1;
worldserver.theChunkProviderServer.loadChunk(blockpos.getX() + l1 >> 4, blockpos.getZ() + i2 >> 4);
}
}
this.clearCurrentTask();
}
protected void setResourcePackFromWorld(String worldNameIn, ISaveHandler saveHandlerIn)
{
File file1 = new File(saveHandlerIn.getWorldDirectory(), "resources.zip");
if (file1.isFile())
{
this.setResourcePack("level://" + worldNameIn + "/" + file1.getName(), "");
}
}
public abstract boolean canStructuresSpawn();
public abstract WorldSettings.GameType getGameType();
/**
* Get the server's difficulty
*/
public abstract EnumDifficulty getDifficulty();
/**
* Defaults to false.
*/
public abstract boolean isHardcore();
public abstract int getOpPermissionLevel();
public abstract boolean func_181034_q();
public abstract boolean func_183002_r();
/**
* Used to display a percent remaining given text and the percentage.
*/
protected void outputPercentRemaining(String message, int percent)
{
this.currentTask = message;
this.percentDone = percent;
logger.info(message + ": " + percent + "%");
}
/**
* Set current task to null and set its percentage to 0.
*/
protected void clearCurrentTask()
{
this.currentTask = null;
this.percentDone = 0;
}
/**
* par1 indicates if a log message should be output.
*/
protected void saveAllWorlds(boolean dontLog)
{
if (!this.worldIsBeingDeleted)
{
for (WorldServer worldserver : this.worldServers)
{
if (worldserver != null)
{
if (!dontLog)
{
logger.info("Saving chunks for level \'" + worldserver.getWorldInfo().getWorldName() + "\'/" + worldserver.provider.getDimensionName());
}
try
{
worldserver.saveAllChunks(true, (IProgressUpdate)null);
}
catch (MinecraftException minecraftexception)
{
logger.warn(minecraftexception.getMessage());
}
}
}
}
}
/**
* Saves all necessary data as preparation for stopping the server.
*/
public void stopServer()
{
if (!this.worldIsBeingDeleted)
{
logger.info("Stopping server");
if (this.getNetworkSystem() != null)
{
this.getNetworkSystem().terminateEndpoints();
}
if (this.serverConfigManager != null)
{
logger.info("Saving players");
this.serverConfigManager.saveAllPlayerData();
this.serverConfigManager.removeAllPlayers();
}
if (this.worldServers != null)
{
logger.info("Saving worlds");
this.saveAllWorlds(false);
for (int i = 0; i < this.worldServers.length; ++i)
{
WorldServer worldserver = this.worldServers[i];
worldserver.flush();
}
}
if (this.usageSnooper.isSnooperRunning())
{
this.usageSnooper.stopSnooper();
}
}
}
public boolean isServerRunning()
{
return this.serverRunning;
}
/**
* Sets the serverRunning variable to false, in order to get the server to shut down.
*/
public void initiateShutdown()
{
this.serverRunning = false;
}
protected void setInstance()
{
mcServer = this;
}
public void run()
{
try
{
if (this.startServer())
{
this.currentTime = getCurrentTimeMillis();
long i = 0L;
this.statusResponse.setServerDescription(new ChatComponentText(this.motd));
this.statusResponse.setProtocolVersionInfo(new ServerStatusResponse.MinecraftProtocolVersionIdentifier("1.8.8", 47));
this.addFaviconToStatusResponse(this.statusResponse);
while (this.serverRunning)
{
long k = getCurrentTimeMillis();
long j = k - this.currentTime;
if (j > 2000L && this.currentTime - this.timeOfLastWarning >= 15000L)
{
logger.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] {Long.valueOf(j), Long.valueOf(j / 50L)});
j = 2000L;
this.timeOfLastWarning = this.currentTime;
}
if (j < 0L)
{
logger.warn("Time ran backwards! Did the system time change?");
j = 0L;
}
i += j;
this.currentTime = k;
if (this.worldServers[0].areAllPlayersAsleep())
{
this.tick();
i = 0L;
}
else
{
while (i > 50L)
{
i -= 50L;
this.tick();
}
}
Thread.sleep(Math.max(1L, 50L - i));
this.serverIsRunning = true;
}
}
else
{
this.finalTick((CrashReport)null);
}
}
catch (Throwable throwable1)
{
logger.error("Encountered an unexpected exception", throwable1);
CrashReport crashreport = null;
if (throwable1 instanceof ReportedException)
{
crashreport = this.addServerInfoToCrashReport(((ReportedException)throwable1).getCrashReport());
}
else
{
crashreport = this.addServerInfoToCrashReport(new CrashReport("Exception in server tick loop", throwable1));
}
File file1 = new File(new File(this.getDataDirectory(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
if (crashreport.saveToFile(file1))
{
logger.error("This crash report has been saved to: " + file1.getAbsolutePath());
}
else
{
logger.error("We were unable to save this crash report to disk.");
}
this.finalTick(crashreport);
}
finally
{
try
{
this.serverStopped = true;
this.stopServer();
}
catch (Throwable throwable)
{
logger.error("Exception stopping the server", throwable);
}
finally
{
this.systemExitNow();
}
}
}
private void addFaviconToStatusResponse(ServerStatusResponse response)
{
File file1 = this.getFile("server-icon.png");
if (file1.isFile())
{
ByteBuf bytebuf = Unpooled.buffer();
try
{
BufferedImage bufferedimage = ImageIO.read(file1);
Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
ImageIO.write(bufferedimage, "PNG", (OutputStream)(new ByteBufOutputStream(bytebuf)));
ByteBuf bytebuf1 = Base64.encode(bytebuf);
response.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
}
catch (Exception exception)
{
logger.error((String)"Couldn\'t load server icon", (Throwable)exception);
}
finally
{
bytebuf.release();
}
}
}
public File getDataDirectory()
{
return new File(".");
}
/**
* Called on exit from the main run() loop.
*/
protected void finalTick(CrashReport report)
{
}
/**
* Directly calls System.exit(0), instantly killing the program.
*/
protected void systemExitNow()
{
}
/**
* Main function called by run() every loop.
*/
public void tick()
{
long i = System.nanoTime();
++this.tickCounter;
if (this.startProfiling)
{
this.startProfiling = false;
this.theProfiler.profilingEnabled = true;
this.theProfiler.clearProfiling();
}
this.theProfiler.startSection("root");
this.updateTimeLightAndEntities();
if (i - this.nanoTimeSinceStatusRefresh >= 5000000000L)
{
this.nanoTimeSinceStatusRefresh = i;
this.statusResponse.setPlayerCountData(new ServerStatusResponse.PlayerCountData(this.getMaxPlayers(), this.getCurrentPlayerCount()));
GameProfile[] agameprofile = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)];
int j = MathHelper.getRandomIntegerInRange(this.random, 0, this.getCurrentPlayerCount() - agameprofile.length);
for (int k = 0; k < agameprofile.length; ++k)
{
agameprofile[k] = ((EntityPlayerMP)this.serverConfigManager.func_181057_v().get(j + k)).getGameProfile();
}
Collections.shuffle(Arrays.asList(agameprofile));
this.statusResponse.getPlayerCountData().setPlayers(agameprofile);
}
if (this.tickCounter % 900 == 0)
{
this.theProfiler.startSection("save");
this.serverConfigManager.saveAllPlayerData();
this.saveAllWorlds(true);
this.theProfiler.endSection();
}
this.theProfiler.startSection("tallying");
this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - i;
this.theProfiler.endSection();
this.theProfiler.startSection("snooper");
if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100)
{
this.usageSnooper.startSnooper();
}
if (this.tickCounter % 6000 == 0)
{
this.usageSnooper.addMemoryStatsToSnooper();
}
this.theProfiler.endSection();
this.theProfiler.endSection();
}
public void updateTimeLightAndEntities()
{
this.theProfiler.startSection("jobs");
synchronized (this.futureTaskQueue)
{
while (!this.futureTaskQueue.isEmpty())
{
Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger);
}
}
this.theProfiler.endStartSection("levels");
for (int j = 0; j < this.worldServers.length; ++j)
{
long i = System.nanoTime();
if (j == 0 || this.getAllowNether())
{
WorldServer worldserver = this.worldServers[j];
this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());
if (this.tickCounter % 20 == 0)
{
this.theProfiler.startSection("timeSync");
this.serverConfigManager.sendPacketToAllPlayersInDimension(new S03PacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionId());
this.theProfiler.endSection();
}
this.theProfiler.startSection("tick");
try
{
worldserver.tick();
}
catch (Throwable throwable1)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world");
worldserver.addWorldInfoToCrashReport(crashreport);
throw new ReportedException(crashreport);
}
try
{
worldserver.updateEntities();
}
catch (Throwable throwable)
{
CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities");
worldserver.addWorldInfoToCrashReport(crashreport1);
throw new ReportedException(crashreport1);
}
this.theProfiler.endSection();
this.theProfiler.startSection("tracker");
worldserver.getEntityTracker().updateTrackedEntities();
this.theProfiler.endSection();
this.theProfiler.endSection();
}
this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i;
}
this.theProfiler.endStartSection("connection");
this.getNetworkSystem().networkTick();
this.theProfiler.endStartSection("players");
this.serverConfigManager.onTick();
this.theProfiler.endStartSection("tickables");
for (int k = 0; k < this.playersOnline.size(); ++k)
{
((ITickable)this.playersOnline.get(k)).update();
}
this.theProfiler.endSection();
}
public boolean getAllowNether()
{
return true;
}
public void startServerThread()
{
this.serverThread = new Thread(this, "Server thread");
this.serverThread.start();
}
/**
* Returns a File object from the specified string.
*/
public File getFile(String fileName)
{
return new File(this.getDataDirectory(), fileName);
}
/**
* Logs the message with a level of WARN.
*/
public void logWarning(String msg)
{
logger.warn(msg);
}
/**
* Gets the worldServer by the given dimension.
*/
public WorldServer worldServerForDimension(int dimension)
{
return dimension == -1 ? this.worldServers[1] : (dimension == 1 ? this.worldServers[2] : this.worldServers[0]);
}
/**
* Returns the server's Minecraft version as string.
*/
public String getMinecraftVersion()
{
return "1.8.8";
}
/**
* Returns the number of players currently on the server.
*/
public int getCurrentPlayerCount()
{
return this.serverConfigManager.getCurrentPlayerCount();
}
/**
* Returns the maximum number of players allowed on the server.
*/
public int getMaxPlayers()
{
return this.serverConfigManager.getMaxPlayers();
}
/**
* Returns an array of the usernames of all the connected players.
*/
public String[] getAllUsernames()
{
return this.serverConfigManager.getAllUsernames();
}
/**
* Returns an array of the GameProfiles of all the connected players
*/
public GameProfile[] getGameProfiles()
{
return this.serverConfigManager.getAllProfiles();
}
public String getServerModName()
{
return "vanilla";
}
/**
* Adds the server info, including from theWorldServer, to the crash report.
*/
public CrashReport addServerInfoToCrashReport(CrashReport report)
{
report.getCategory().addCrashSectionCallable("Profiler Position", new Callable<String>()
{
public String call() throws Exception
{
return MinecraftServer.this.theProfiler.profilingEnabled ? MinecraftServer.this.theProfiler.getNameOfLastSection() : "N/A (disabled)";
}
});
if (this.serverConfigManager != null)
{
report.getCategory().addCrashSectionCallable("Player Count", new Callable<String>()
{
public String call()
{
return MinecraftServer.this.serverConfigManager.getCurrentPlayerCount() + " / " + MinecraftServer.this.serverConfigManager.getMaxPlayers() + "; " + MinecraftServer.this.serverConfigManager.func_181057_v();
}
});
}
return report;
}
public List<String> getTabCompletions(ICommandSender sender, String input, BlockPos pos)
{
List<String> list = Lists.<String>newArrayList();
if (input.startsWith("/"))
{
input = input.substring(1);
boolean flag = !input.contains(" ");
List<String> list1 = this.commandManager.getTabCompletionOptions(sender, input, pos);
if (list1 != null)
{
for (String s2 : list1)
{
if (flag)
{
list.add("/" + s2);
}
else
{
list.add(s2);
}
}
}
return list;
}
else
{
String[] astring = input.split(" ", -1);
String s = astring[astring.length - 1];
for (String s1 : this.serverConfigManager.getAllUsernames())
{
if (CommandBase.doesStringStartWith(s, s1))
{
list.add(s1);
}
}
return list;
}
}
/**
* Gets mcServer.
*/
public static MinecraftServer getServer()
{
return mcServer;
}
public boolean isAnvilFileSet()
{
return this.anvilFile != null;
}
/**
* Gets the name of this command sender (usually username, but possibly "Rcon")
*/
public String getName()
{
return "Server";
}
/**
* Send a chat message to the CommandSender
*/
public void addChatMessage(IChatComponent component)
{
logger.info(component.getUnformattedText());
}
/**
* Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not
*/
public boolean canCommandSenderUseCommand(int permLevel, String commandName)
{
return true;
}
public ICommandManager getCommandManager()
{
return this.commandManager;
}
/**
* Gets KeyPair instanced in MinecraftServer.
*/
public KeyPair getKeyPair()
{
return this.serverKeyPair;
}
/**
* Returns the username of the server owner (for integrated servers)
*/
public String getServerOwner()
{
return this.serverOwner;
}
/**
* Sets the username of the owner of this server (in the case of an integrated server)
*/
public void setServerOwner(String owner)
{
this.serverOwner = owner;
}
public boolean isSinglePlayer()
{
return this.serverOwner != null;
}
public String getFolderName()
{
return this.folderName;
}
public void setFolderName(String name)
{
this.folderName = name;
}
public void setWorldName(String p_71246_1_)
{
this.worldName = p_71246_1_;
}
public String getWorldName()
{
return this.worldName;
}
public void setKeyPair(KeyPair keyPair)
{
this.serverKeyPair = keyPair;
}
public void setDifficultyForAllWorlds(EnumDifficulty difficulty)
{
for (int i = 0; i < this.worldServers.length; ++i)
{
World world = this.worldServers[i];
if (world != null)
{
if (world.getWorldInfo().isHardcoreModeEnabled())
{
world.getWorldInfo().setDifficulty(EnumDifficulty.HARD);
world.setAllowedSpawnTypes(true, true);
}
else if (this.isSinglePlayer())
{
world.getWorldInfo().setDifficulty(difficulty);
world.setAllowedSpawnTypes(world.getDifficulty() != EnumDifficulty.PEACEFUL, true);
}
else
{
world.getWorldInfo().setDifficulty(difficulty);
world.setAllowedSpawnTypes(this.allowSpawnMonsters(), this.canSpawnAnimals);
}
}
}
}
protected boolean allowSpawnMonsters()
{
return true;
}
/**
* Gets whether this is a demo or not.
*/
public boolean isDemo()
{
return this.isDemo;
}
/**
* Sets whether this is a demo or not.
*/
public void setDemo(boolean demo)
{
this.isDemo = demo;
}
public void canCreateBonusChest(boolean enable)
{
this.enableBonusChest = enable;
}
public ISaveFormat getActiveAnvilConverter()
{
return this.anvilConverterForAnvilFile;
}
/**
* WARNING : directly calls
* getActiveAnvilConverter().deleteWorldDirectory(theWorldServer[0].getSaveHandler().getWorldDirectoryName());
*/
public void deleteWorldAndStopServer()
{
this.worldIsBeingDeleted = true;
this.getActiveAnvilConverter().flushCache();
for (int i = 0; i < this.worldServers.length; ++i)
{
WorldServer worldserver = this.worldServers[i];
if (worldserver != null)
{
worldserver.flush();
}
}
this.getActiveAnvilConverter().deleteWorldDirectory(this.worldServers[0].getSaveHandler().getWorldDirectoryName());
this.initiateShutdown();
}
public String getResourcePackUrl()
{
return this.resourcePackUrl;
}
public String getResourcePackHash()
{
return this.resourcePackHash;
}
public void setResourcePack(String url, String hash)
{
this.resourcePackUrl = url;
this.resourcePackHash = hash;
}
public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper)
{
playerSnooper.addClientStat("whitelist_enabled", Boolean.valueOf(false));
playerSnooper.addClientStat("whitelist_count", Integer.valueOf(0));
if (this.serverConfigManager != null)
{
playerSnooper.addClientStat("players_current", Integer.valueOf(this.getCurrentPlayerCount()));
playerSnooper.addClientStat("players_max", Integer.valueOf(this.getMaxPlayers()));
playerSnooper.addClientStat("players_seen", Integer.valueOf(this.serverConfigManager.getAvailablePlayerDat().length));
}
playerSnooper.addClientStat("uses_auth", Boolean.valueOf(this.onlineMode));
playerSnooper.addClientStat("gui_state", this.getGuiEnabled() ? "enabled" : "disabled");
playerSnooper.addClientStat("run_time", Long.valueOf((getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L));
playerSnooper.addClientStat("avg_tick_ms", Integer.valueOf((int)(MathHelper.average(this.tickTimeArray) * 1.0E-6D)));
int i = 0;
if (this.worldServers != null)
{
for (int j = 0; j < this.worldServers.length; ++j)
{
if (this.worldServers[j] != null)
{
WorldServer worldserver = this.worldServers[j];
WorldInfo worldinfo = worldserver.getWorldInfo();
playerSnooper.addClientStat("world[" + i + "][dimension]", Integer.valueOf(worldserver.provider.getDimensionId()));
playerSnooper.addClientStat("world[" + i + "][mode]", worldinfo.getGameType());
playerSnooper.addClientStat("world[" + i + "][difficulty]", worldserver.getDifficulty());
playerSnooper.addClientStat("world[" + i + "][hardcore]", Boolean.valueOf(worldinfo.isHardcoreModeEnabled()));
playerSnooper.addClientStat("world[" + i + "][generator_name]", worldinfo.getTerrainType().getWorldTypeName());
playerSnooper.addClientStat("world[" + i + "][generator_version]", Integer.valueOf(worldinfo.getTerrainType().getGeneratorVersion()));
playerSnooper.addClientStat("world[" + i + "][height]", Integer.valueOf(this.buildLimit));
playerSnooper.addClientStat("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.getChunkProvider().getLoadedChunkCount()));
++i;
}
}
}
playerSnooper.addClientStat("worlds", Integer.valueOf(i));
}
public void addServerTypeToSnooper(PlayerUsageSnooper playerSnooper)
{
playerSnooper.addStatToSnooper("singleplayer", Boolean.valueOf(this.isSinglePlayer()));
playerSnooper.addStatToSnooper("server_brand", this.getServerModName());
playerSnooper.addStatToSnooper("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported");
playerSnooper.addStatToSnooper("dedicated", Boolean.valueOf(this.isDedicatedServer()));
}
/**
* Returns whether snooping is enabled or not.
*/
public boolean isSnooperEnabled()
{
return true;
}
public abstract boolean isDedicatedServer();
public boolean isServerInOnlineMode()
{
return this.onlineMode;
}
public void setOnlineMode(boolean online)
{
this.onlineMode = online;
}
public boolean getCanSpawnAnimals()
{
return this.canSpawnAnimals;
}
public void setCanSpawnAnimals(boolean spawnAnimals)
{
this.canSpawnAnimals = spawnAnimals;
}
public boolean getCanSpawnNPCs()
{
return this.canSpawnNPCs;
}
public abstract boolean func_181035_ah();
public void setCanSpawnNPCs(boolean spawnNpcs)
{
this.canSpawnNPCs = spawnNpcs;
}
public boolean isPVPEnabled()
{
return this.pvpEnabled;
}
public void setAllowPvp(boolean allowPvp)
{
this.pvpEnabled = allowPvp;
}
public boolean isFlightAllowed()
{
return this.allowFlight;
}
public void setAllowFlight(boolean allow)
{
this.allowFlight = allow;
}
/**
* Return whether command blocks are enabled.
*/
public abstract boolean isCommandBlockEnabled();
public String getMOTD()
{
return this.motd;
}
public void setMOTD(String motdIn)
{
this.motd = motdIn;
}
public int getBuildLimit()
{
return this.buildLimit;
}
public void setBuildLimit(int maxBuildHeight)
{
this.buildLimit = maxBuildHeight;
}
public boolean isServerStopped()
{
return this.serverStopped;
}
public ServerConfigurationManager getConfigurationManager()
{
return this.serverConfigManager;
}
public void setConfigManager(ServerConfigurationManager configManager)
{
this.serverConfigManager = configManager;
}
/**
* Sets the game type for all worlds.
*/
public void setGameType(WorldSettings.GameType gameMode)
{
for (int i = 0; i < this.worldServers.length; ++i)
{
getServer().worldServers[i].getWorldInfo().setGameType(gameMode);
}
}
public NetworkSystem getNetworkSystem()
{
return this.networkSystem;
}
public boolean serverIsInRunLoop()
{
return this.serverIsRunning;
}
public boolean getGuiEnabled()
{
return false;
}
/**
* On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections.
*/
public abstract String shareToLAN(WorldSettings.GameType type, boolean allowCheats);
public int getTickCounter()
{
return this.tickCounter;
}
public void enableProfiling()
{
this.startProfiling = true;
}
public PlayerUsageSnooper getPlayerUsageSnooper()
{
return this.usageSnooper;
}
/**
* Get the position in the world. <b>{@code null} is not allowed!</b> If you are not an entity in the world, return
* the coordinates 0, 0, 0
*/
public BlockPos getPosition()
{
return BlockPos.ORIGIN;
}
/**
* Get the position vector. <b>{@code null} is not allowed!</b> If you are not an entity in the world, return 0.0D,
* 0.0D, 0.0D
*/
public Vec3 getPositionVector()
{
return new Vec3(0.0D, 0.0D, 0.0D);
}
/**
* Get the world, if available. <b>{@code null} is not allowed!</b> If you are not an entity in the world, return
* the overworld
*/
public World getEntityWorld()
{
return this.worldServers[0];
}
/**
* Returns the entity associated with the command sender. MAY BE NULL!
*/
public Entity getCommandSenderEntity()
{
return null;
}
/**
* Return the spawn protection area's size.
*/
public int getSpawnProtectionSize()
{
return 16;
}
public boolean isBlockProtected(World worldIn, BlockPos pos, EntityPlayer playerIn)
{
return false;
}
public boolean getForceGamemode()
{
return this.isGamemodeForced;
}
public Proxy getServerProxy()
{
return this.serverProxy;
}
public static long getCurrentTimeMillis()
{
return System.currentTimeMillis();
}
public int getMaxPlayerIdleMinutes()
{
return this.maxPlayerIdleMinutes;
}
public void setPlayerIdleTimeout(int idleTimeout)
{
this.maxPlayerIdleMinutes = idleTimeout;
}
/**
* Get the formatted ChatComponent that will be used for the sender's username in chat
*/
public IChatComponent getDisplayName()
{
return new ChatComponentText(this.getName());
}
public boolean isAnnouncingPlayerAchievements()
{
return true;
}
public MinecraftSessionService getMinecraftSessionService()
{
return this.sessionService;
}
public GameProfileRepository getGameProfileRepository()
{
return this.profileRepo;
}
public PlayerProfileCache getPlayerProfileCache()
{
return this.profileCache;
}
public ServerStatusResponse getServerStatusResponse()
{
return this.statusResponse;
}
public void refreshStatusNextTick()
{
this.nanoTimeSinceStatusRefresh = 0L;
}
public Entity getEntityFromUuid(UUID uuid)
{
for (WorldServer worldserver : this.worldServers)
{
if (worldserver != null)
{
Entity entity = worldserver.getEntityFromUuid(uuid);
if (entity != null)
{
return entity;
}
}
}
return null;
}
/**
* Returns true if the command sender should be sent feedback about executed commands
*/
public boolean sendCommandFeedback()
{
return getServer().worldServers[0].getGameRules().getBoolean("sendCommandFeedback");
}
public void setCommandStat(CommandResultStats.Type type, int amount)
{
}
public int getMaxWorldSize()
{
return 29999984;
}
public <V> ListenableFuture<V> callFromMainThread(Callable<V> callable)
{
Validate.notNull(callable);
if (!this.isCallingFromMinecraftThread() && !this.isServerStopped())
{
ListenableFutureTask<V> listenablefuturetask = ListenableFutureTask.<V>create(callable);
synchronized (this.futureTaskQueue)
{
this.futureTaskQueue.add(listenablefuturetask);
return listenablefuturetask;
}
}
else
{
try
{
return Futures.<V>immediateFuture(callable.call());
}
catch (Exception exception)
{
return Futures.immediateFailedCheckedFuture(exception);
}
}
}
public ListenableFuture<Object> addScheduledTask(Runnable runnableToSchedule)
{
Validate.notNull(runnableToSchedule);
return this.<Object>callFromMainThread(Executors.callable(runnableToSchedule));
}
public boolean isCallingFromMinecraftThread()
{
return Thread.currentThread() == this.serverThread;
}
/**
* The compression treshold. If the packet is larger than the specified amount of bytes, it will be compressed
*/
public int getNetworkCompressionTreshold()
{
return 256;
}
}
| 46,795
|
Java
|
.java
| 1,316
| 26.303191
| 262
| 0.615429
|
narumii/Niko
| 42
| 8
| 2
|
GPL-3.0
|
9/4/2024, 7:11:02 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 46,795
|
1,318,929
|
A_test764.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test764.java
|
package branch_in;
public class A_test764 {
public void foo() {
int x = 0;
for (int i= 0; i < 3; i++) {
/*[*/
if(i == 2) {
x = 2;
continue;
}
System.out.println();
/*]*/
}
System.out.println(x);
}
}
| 235
|
Java
|
.java
| 16
| 11.4375
| 30
| 0.509259
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 235
|
3,104,277
|
PRF.java
|
FzArnob_QRQueen/sources/net/lingala/zip4j/crypto/PBKDF2/PRF.java
|
package net.lingala.zip4j.crypto.PBKDF2;
interface PRF {
byte[] doFinal(byte[] bArr);
int getHLen();
void init(byte[] bArr);
}
| 142
|
Java
|
.java
| 6
| 20.166667
| 40
| 0.684211
|
FzArnob/QRQueen
| 5
| 0
| 0
|
GPL-3.0
|
9/4/2024, 10:49:14 PM (Europe/Amsterdam)
| false
| false
| false
| true
| false
| false
| true
| true
| 142
|
1,320,109
|
InvertedPair.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/InferTypeArguments/testPairDance/in/InvertedPair.java
|
package p;
class InvertedPair<A, B> extends Pair<B, A> {
public B getA() {
return super.getA();
}
public void setB(A bee) {
super.setB(bee);
}
}
| 178
|
Java
|
.java
| 9
| 15.111111
| 45
| 0.571429
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 178
|
1,317,231
|
A.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/RenameType/testFail78/in/A.java
|
package p;
class A{
}
class X{
void m(){
class B{ }
class C{
boolean m(Object o){
return o instanceof A;
}
}
}
}
| 132
|
Java
|
.java
| 13
| 7.692308
| 26
| 0.583333
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 132
|
487,356
|
SessionTunnelFlow.java
|
Mobile-IoT-Security-Lab_HideDroid/netbare-core/src/main/java/com/github/megatronking/netbare/gateway/SessionTunnelFlow.java
|
/* NetBare - An android network capture and injection library.
* Copyright (C) 2018-2019 Megatron King
* Copyright (C) 2018-2019 GuoShi
*
* NetBare is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* NetBare is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with NetBare.
* If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.megatronking.netbare.gateway;
import com.github.megatronking.netbare.NetBareConfig;
import com.github.megatronking.netbare.NetBareUtils;
import com.github.megatronking.netbare.ip.Protocol;
import com.github.megatronking.netbare.net.Session;
/**
* A tunnel flow contains the session information.
*
* @author Megatron King
* @since 2018-11-05 21:43
*/
public abstract class SessionTunnelFlow implements TunnelFlow {
private Session mSession;
/* package */ void setSession(Session session) {
mSession = session;
}
/**
* Returns the session's unique id.
*
* @return The session id.
*/
public String id() {
return mSession.id;
}
/**
* Returns the session created time, you can think of it as the start time of the request.
*
* @return Session created time.
*/
public long time() {
return mSession.time;
}
/**
* Returns the identifier of this session's process uid. This value is not guaranteed, it is up
* to {@link NetBareConfig#dumpUid}. And if dumps the uid failed, it will return 0.
*
* @return The session's process uid.
*/
public int uid() {
return mSession.uid;
}
/**
* Returns the remote server's IPV4 address.
*
* @return The remote server's IPV4 address.
*/
public String ip() {
return NetBareUtils.convertIp(mSession.remoteIp);
}
/**
* Returns the remote server's host name.
*
* @return The remote server's host name.
*/
public String host() {
return mSession.host;
}
/**
* Returns the remote server's port.
*
* @return The remote server's port.
*/
public int port() {
return NetBareUtils.convertPort(mSession.remotePort);
}
/**
* Returns the IP protocol.
*
* @return IP protocol.
*/
public Protocol protocol() {
return mSession.protocol;
}
}
| 2,771
|
Java
|
.java
| 89
| 26.359551
| 99
| 0.67603
|
Mobile-IoT-Security-Lab/HideDroid
| 182
| 11
| 10
|
AGPL-3.0
|
9/4/2024, 7:07:37 PM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| false
| true
| true
| 2,771
|
4,981,681
|
Pcc_defines.java
|
GliderWinchItems_db/pcc_gen_defines/src/derbytest/Pcc_defines.java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package derbytest;
import java.sql.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import static javax.management.remote.JMXConnectorFactory.connect;
/**
*
* @author deh
*/
public class Pcc_defines {
private static String driverName = "org.apache.derby.jdbc.EmbeddedDriver";
private static String clientDriverName = "org.apache.derby.jdbc.ClientDriver";
private static String databaseConnectionName = "jdbc:derby://localhost:1527/pcc";
private static Object LocalDateTime;
/**
* @param args the command line arguments
* @throws java.sql.SQLException
* @throws java.lang.ClassNotFoundException
*/
public static void main(String[] args) throws SQLException, ClassNotFoundException {
Connection connection = null;
PreparedStatement pstmt = null;
Statement stmt = null;
// String query = "SELECT * FROM APP.CANID "
// + "WHERE CANID_HEX = 'D1C0000C' ";
// String query = "select * from APP.CANID "
// + "WHERE CANID_TYPE = 'LAUNCH' "
// + "ORDER BY CANID_TYPE DESC, CANID_HEX ASC";
String query = "select * from APP.PARAM_LIST "
+ "ORDER BY FUNCTION_TYPE";
//Check for DB drivers
try{
Class.forName(clientDriverName);
Class.forName(driverName);
}catch(java.lang.ClassNotFoundException e) {
System.out.println("client Driver Name, or driver Name exception\n");
throw e;
}
// xxx
//Try to connect to the specified database
try{
System.out.println("// Defines from database pcc");
java.util.Date date= new java.util.Date();
System.out.format("// %s\n",new Timestamp(date.getTime()));
// System.out.println("#ifndef DATABASE_DEFINES");
// System.out.println("#define DATABASE_DEFINES\n");
connection = DriverManager.getConnection(databaseConnectionName);
// System.out.println("// Seems to have made the database connection\n");
stmt = connection.createStatement();
ResultSet rs;
Integer totalct = 0;
// Generate #defines for NUMBER_TYPE table
totalct += gendefines_Canid(stmt);
// Generate #defines for NUMBER_TYPE table
totalct += gendefines_Number_type(stmt);
// Generate #defines for CMD_CODES table
totalct += gendefines_Cmd_codes(stmt);
// Generate #defines for PAYLOAD_TYPE table
totalct += gendefines_Payload_type(stmt);
// Generate #defines for PARAM_LIST table
totalct += gendefines_Param_List(stmt);
// Generate #defines for READINGS_LIST table
totalct += gendefines_Readings_List(stmt);
// Generate #defines for FUNC_BIT_PARAM table
totalct += gendefines_Func_Bit_Param(stmt);
// Generate #defines for FUNCTIONS_TYPE table
totalct += gendefines_Functions_Type(stmt);
// Generate #defines for READINGS_BOARD table
totalct += gendefines_Readings_Board(stmt);
System.out.format("\n/* TOTAL COUNT OF #defines = %d */\n",totalct);
// System.out.println("#endif\n");
System.out.println("/* Test 2016/06/12 */\n");
}
catch(SQLException e) {
//TODO Fix error handling
e.printStackTrace();
throw e;
}
finally {
if (pstmt != null) pstmt.close();
}
}
private static int gendefines_Canid(Statement stmt) throws SQLException{
String query = "select * from CANID ";
ResultSet rs;
rs = stmt.executeQuery(query);
Integer count = 0;
while (rs.next()) {
long k = Long.parseLong(rs.getString("CANID_HEX"), 16);
if (((k & 0x001fff8)!= 0) && ((k & 0x4) == 0) ){
System.out.format("ERROR Illegal 11b CAN ID ct: %d %s %08X %s\n",count,
rs.getString("CANID_NAME"),
k,rs.getString("DESCRIPTION") );
}
if ((k & 0x1) != 0){
System.out.format("ERROR Illegal bit0 CAN ID ct: %d %s %08X %s\n",count,
rs.getString("CANID_NAME"),
k,rs.getString("DESCRIPTION") );
}
count += 1;
}
System.out.format("\n#define CANID_COUNT %d\n",count);
rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.format("#define " + "%-24s",rs.getString("CANID_NAME"));
System.out.format(" 0x%-10s", rs.getString("CANID_HEX"));
System.out.format("// " + "%-15s: ", rs.getString("CANID_TYPE"));
System.out.format("%s" + "\n", rs.getString("DESCRIPTION"));
}
return count;
}
private static int gendefines_Number_type(Statement stmt) throws SQLException{
String query = "select * from APP.NUMBER_TYPE ";
ResultSet rs;
rs = stmt.executeQuery(query);
Integer count = 0;
while (rs.next()) {count += 1;}
System.out.format("\n#define NUMBER_TYPE_COUNT %d\n",count);
rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.format("#define " + "%-24s",rs.getString("TYPE_NAME"));
System.out.format("%-10s",rs.getString("TYPE_CODE"));
System.out.format("// " + "%-12s",rs.getString("TYPE_CT"));
System.out.format("%s" + "\n",rs.getString("DESCRIPTION9"));
}
return count;
}
private static int gendefines_Cmd_codes(Statement stmt) throws SQLException{
String query = "select * from APP.CMD_CODES ";
ResultSet rs;
rs = stmt.executeQuery(query);
Integer count = 0;
while (rs.next()) {count += 1;}
System.out.format("\n#define CMD_CODES_COUNT %d\n",count);
rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.format("#define " + "%-24s",rs.getString("CMD_CODE_NAME"));
System.out.format("%-10s",rs.getString("CMD_CODE_NUMBER"));
System.out.format("// " + "%-12s\n",rs.getString("DESCRIPTION4"));
}
return count;
}
private static int gendefines_Payload_type(Statement stmt) throws SQLException{
String query = "select * from PAYLOAD_TYPE ";
ResultSet rs;
rs = stmt.executeQuery(query);
Integer count = 0;
while (rs.next()) {count += 1;}
System.out.format("\n#define PAYLOAD_TYPE_COUNT %d\n",count);
rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.format("#define " + "%-24s",rs.getString("PAYLOAD_TYPE_NAME"));
System.out.format("%-10s", rs.getString("PAYLOAD_TYPE_CODE"));
System.out.format("// " + "%-48s\n", rs.getString("DESCRIPTION12"));
}
return count;
}
private static int gendefines_Param_List(Statement stmt) throws SQLException{
String query = "select * from PARAM_LIST ";
ResultSet rs;
rs = stmt.executeQuery(query);
Integer count = 0;
Integer count1 = 0;
Integer flag = 0;
while (rs.next()) {count += 1;}
System.out.format("\n#define PARAM_LIST_COUNT %d\t// TOTAL COUNT OF PARAMETER LIST\n\n",count);
rs = stmt.executeQuery(query);
String old = "";
String tmp;
while (rs.next()) {
tmp = rs.getString("FUNCTION_TYPE");
if (!(tmp .equals(old))){
if (flag == 0){
flag = 1;
}else{
System.out.format("\n#define PARAM_LIST_CT_%s\t%d\t// Count of same FUNCTION_TYPE in preceding list\n\n",old, count1);
count1 = 0;
}
}
old = tmp;
System.out.format("#define " + "%-24s\t",rs.getString("PARAM_NAME"));
System.out.format("%-10s", rs.getString("PARAM_CODE"));
System.out.format("// " + "%-48s\n", rs.getString("DESCRIPTION10"));
count1 += 1;
}
System.out.format("\n#define PARAM_LIST_CT_%s\t%d\t// Count of same FUNCTION_TYPE in preceding list\n\n",old, count1);
return count;
}
private static int gendefines_Readings_List(Statement stmt) throws SQLException{
String query = "select * from READINGS_LIST ";
ResultSet rs;
rs = stmt.executeQuery(query);
Integer count = 0;
while (rs.next()) {count += 1;}
System.out.format("\n#define READINGS_LIST_COUNT %d\n",count);
rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.format("#define " + "%-24s\t",rs.getString("READINGS_NAME"));
System.out.format("%-10s", rs.getString("READINGS_CODE"));
System.out.format("// " + "%-48s\n", rs.getString("DESCRIPTION16"));
}
return count;
}
private static int gendefines_Func_Bit_Param(Statement stmt) throws SQLException{
String query = "select * from FUNC_BIT_PARAM";
ResultSet rs;
rs = stmt.executeQuery(query);
Integer count = 0;
while (rs.next()) {count += 1;}
System.out.format("\n#define FUNC_BIT_PARAM_COUNT %d\n",count);
rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.format("#define " + "%-24s\t",rs.getString("FUNC_BIT_PARAM_NAME"));
System.out.format("%-10s", rs.getString("FUNC_BIT_PARAM_VAL"));
System.out.format("// " + "%-20s", rs.getString("FUNCTION_TYPE"));
System.out.format("%-48s\n", rs.getString("DESCRIPTION5"));
}
return count;
}
private static int gendefines_CanUnit(Statement stmt) throws SQLException{
String query = "select * from CAN_UNIT";
ResultSet rs;
rs = stmt.executeQuery(query);
Integer count = 0;
while (rs.next()) {count += 1;}
System.out.format("\n#define CANUNIT_COUNT %d\n",count);
rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.format("#define " + "%-24s\t",rs.getString("CAN_UNIT_NAME"));
System.out.format("%-10s", rs.getString("CAN_UNIT_CODE"));
System.out.format("// " + "%-20s", rs.getString("CANID_NAME"));
System.out.format("%-48s\n", rs.getString("DESCRIPTION3"));
}
return count;
}
private static int gendefines_Functions_Type(Statement stmt) throws SQLException{
String query = "select * from FUNCTIONS_TYPE";
ResultSet rs;
rs = stmt.executeQuery(query);
Integer count = 0;
while (rs.next()) {count += 1;}
System.out.format("\n#define FUNCTION_TYPE_COUNT %d\n",count);
rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.format("#define FUNCTION_TYPE_" + "%-24s\t",rs.getString("FUNCTION_TYPE"));
System.out.format("%-10s", rs.getInt("FUNCTION_TYPE_CODE"));
System.out.format("// " + "%-48s\n", rs.getString("DESCRIPTION8"));
}
return count;
}
private static int gendefines_Readings_Board(Statement stmt) throws SQLException{
String query = "select * from READINGS_BOARD";
ResultSet rs;
rs = stmt.executeQuery(query);
Integer count = 0;
while (rs.next()) {count += 1;}
System.out.format("\n#define READINGS_BOARD_COUNT %d\n",count);
rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.format("#define " + "%-24s\t",rs.getString("READINGS_BOARDNAME"));
System.out.format("%-10s", rs.getInt("READINGS_BOARDCODE"));
System.out.format("// " + "%-48s\n", rs.getString("DESCRIPTION15"));
}
return count;
}
}
| 13,845
|
Java
|
.java
| 273
| 35.754579
| 142
| 0.529453
|
GliderWinchItems/db
| 1
| 1
| 0
|
GPL-3.0
|
9/5/2024, 12:38:04 AM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| false
| true
| 13,845
|
1,319,653
|
A_test1003.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/initializer_out/A_test1003.java
|
package initializer_out;
public class A_test1003 {
static {
int i= extracted();
}
protected static int extracted() {
return /*[*/bar()/*]*/;
}
private static int bar() {
return 10;
}
}
| 200
|
Java
|
.java
| 12
| 14.416667
| 35
| 0.664865
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 200
|
3,452,936
|
AppletViewerPanel.java
|
alexkasko_openjdk-icedtea7/jdk/src/share/classes/sun/applet/AppletViewerPanel.java
|
/*
* Copyright (c) 1995, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.applet;
import java.util.*;
import java.io.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.*;
import java.applet.*;
import sun.tools.jar.*;
/**
* Sample applet panel class. The panel manages and manipulates the
* applet as it is being loaded. It forks a seperate thread in a new
* thread group to call the applet's init(), start(), stop(), and
* destroy() methods.
*
* @author Arthur van Hoff
*/
public class AppletViewerPanel extends AppletPanel {
/* Are we debugging? */
protected static boolean debug = false;
/**
* The document url.
*/
protected URL documentURL;
/**
* The base url.
*/
protected URL baseURL;
/**
* The attributes of the applet.
*/
protected Hashtable<String,String> atts;
/*
* JDK 1.1 serialVersionUID
*/
private static final long serialVersionUID = 8890989370785545619L;
/**
* Construct an applet viewer and start the applet.
*/
protected AppletViewerPanel(URL documentURL, Hashtable<String,String> atts) {
this.documentURL = documentURL;
this.atts = atts;
String att = getParameter("codebase");
if (att != null) {
if (!att.endsWith("/")) {
att += "/";
}
try {
baseURL = new URL(documentURL, att);
} catch (MalformedURLException e) {
}
}
if (baseURL == null) {
String file = documentURL.getFile();
int i = file.lastIndexOf('/');
if (i >= 0 && i < file.length() - 1) {
try {
baseURL = new URL(documentURL, file.substring(0, i + 1));
} catch (MalformedURLException e) {
}
}
}
// when all is said & done, baseURL shouldn't be null
if (baseURL == null)
baseURL = documentURL;
}
/**
* Get an applet parameter.
*/
public String getParameter(String name) {
return atts.get(name.toLowerCase());
}
/**
* Get the document url.
*/
public URL getDocumentBase() {
return documentURL;
}
/**
* Get the base url.
*/
public URL getCodeBase() {
return baseURL;
}
/**
* Get the width.
*/
public int getWidth() {
String w = getParameter("width");
if (w != null) {
return Integer.valueOf(w).intValue();
}
return 0;
}
/**
* Get the height.
*/
public int getHeight() {
String h = getParameter("height");
if (h != null) {
return Integer.valueOf(h).intValue();
}
return 0;
}
/**
* Get initial_focus
*/
public boolean hasInitialFocus()
{
// 6234219: Do not set initial focus on an applet
// during startup if applet is targeted for
// JDK 1.1/1.2. [stanley.ho]
if (isJDK11Applet() || isJDK12Applet())
return false;
String initialFocus = getParameter("initial_focus");
if (initialFocus != null)
{
if (initialFocus.toLowerCase().equals("false"))
return false;
}
return true;
}
/**
* Get the code parameter
*/
public String getCode() {
return getParameter("code");
}
/**
* Return the list of jar files if specified.
* Otherwise return null.
*/
public String getJarFiles() {
return getParameter("archive");
}
/**
* Return the value of the object param
*/
public String getSerializedObject() {
return getParameter("object");// another name?
}
/**
* Get the applet context. For now this is
* also implemented by the AppletPanel class.
*/
public AppletContext getAppletContext() {
return (AppletContext)getParent();
}
protected static void debug(String s) {
if(debug)
System.err.println("AppletViewerPanel:::" + s);
}
protected static void debug(String s, Throwable t) {
if(debug) {
t.printStackTrace();
debug(s);
}
}
}
| 5,475
|
Java
|
.java
| 182
| 23.434066
| 81
| 0.606769
|
alexkasko/openjdk-icedtea7
| 3
| 14
| 0
|
GPL-2.0
|
9/4/2024, 11:28:51 PM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| true
| true
| 5,475
|
1,320,683
|
A.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/RenameMethodInInterface/test17/in/A.java
|
//renaming I.m to k
package p;
interface I{
void m();
}
interface J{
void m();
}
class A{
public void m(){};
}
class C extends A implements I, J{
public void m(){};
}
| 170
|
Java
|
.java
| 14
| 10.928571
| 34
| 0.66879
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 170
|
2,924,666
|
ReferenceExpressionSyntaxTest.java
|
maxeler_eclipse/eclipse.jdt.core/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceExpressionSyntaxTest.java
|
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.parser;
import java.io.File;
import java.io.IOException;
import junit.framework.Test;
import org.eclipse.jdt.core.tests.util.CompilerTestSetup;
public class ReferenceExpressionSyntaxTest extends AbstractSyntaxTreeTest {
private static String jsr335TestScratchArea = "c:\\Jsr335TestScratchArea";
private static String referenceCompiler = "C:\\jdk-7-ea-bin-b75-windows-i586-30_oct_2009\\jdk7\\bin\\javac.exe"; // TODO: Patch when RI becomes available.
public static Class testClass() {
return ReferenceExpressionSyntaxTest.class;
}
public void initialize(CompilerTestSetup setUp) {
super.initialize(setUp);
}
public static Test suite() {
return buildMinimalComplianceTestSuite(testClass(), F_1_8);
}
public ReferenceExpressionSyntaxTest(String testName){
super(testName, referenceCompiler, jsr335TestScratchArea);
if (referenceCompiler != null) {
File f = new File(jsr335TestScratchArea);
if (!f.exists()) {
f.mkdir();
}
CHECK_ALL |= CHECK_JAVAC_PARSER;
}
}
static {
// TESTS_NAMES = new String[] { "test0012" };
// TESTS_NUMBERS = new int[] { 133, 134, 135 };
if (!(new File(referenceCompiler).exists())) {
referenceCompiler = null;
jsr335TestScratchArea = null;
}
}
// Reference expression - super:: form, without type arguments.
public void test0001() throws IOException {
String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X extends Y {\n" +
" public static void main(String [] args) {\n" +
" new X().doit();\n" +
" }\n" +
" void doit() {\n" +
" I i = super::foo;\n" +
" i.foo(10); \n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X extends Y {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" new X().doit();\n" +
" }\n" +
" void doit() {\n" +
" I i = super::foo;\n" +
" i.foo(10);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
" public void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0001", expectedUnitToString);
}
// Reference expression - super:: form, with type arguments.
public void test0002() throws IOException {
String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X extends Y {\n" +
" public static void main(String [] args) {\n" +
" new X().doit();\n" +
" }\n" +
" void doit() {\n" +
" I i = super::<String>foo;\n" +
" i.foo(10); \n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X extends Y {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" new X().doit();\n" +
" }\n" +
" void doit() {\n" +
" I i = super::<String>foo;\n" +
" i.foo(10);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
" public void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0002", expectedUnitToString);
}
// Reference expression - SimpleName:: form, without type arguments.
public void test0003() throws IOException {
String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y::foo;\n" +
" i.foo(10); \n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public static void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y::foo;\n" +
" i.foo(10);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
" public static void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0003", expectedUnitToString);
}
// Reference expression - SimpleName:: form, with type arguments.
public void test0004() throws IOException {
String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y::<String>foo;\n" +
" i.foo(10); \n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public static void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y::<String>foo;\n" +
" i.foo(10);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
" public static void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0004", expectedUnitToString);
}
// Reference expression - QualifiedName:: form, without type arguments.
public void test0005() throws IOException {
String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y.Z::foo;\n" +
" i.foo(10); \n" +
" }\n" +
"}\n" +
"class Y {\n" +
" static class Z {\n" +
" public static void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y.Z::foo;\n" +
" i.foo(10);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" static class Z {\n" +
" Z() {\n" +
" super();\n" +
" }\n" +
" public static void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0005", expectedUnitToString);
}
// Reference expression - QualifiedName:: form, with type arguments.
public void test0006() throws IOException {
String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y.Z::<String>foo;\n" +
" i.foo(10); \n" +
" }\n" +
"}\n" +
"class Y {\n" +
" static class Z {\n" +
" public static void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y.Z::<String>foo;\n" +
" i.foo(10);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" static class Z {\n" +
" Z() {\n" +
" super();\n" +
" }\n" +
" public static void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0006", expectedUnitToString);
}
// Reference expression - Primary:: form, without type arguments.
public void test0007() throws IOException {
String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = new Y()::foo;\n" +
" i.foo(10); \n" +
" }\n" +
"}\n" +
"class Y {\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = new Y()::foo;\n" +
" i.foo(10);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0007", expectedUnitToString);
}
// Reference expression - primary:: form, with type arguments.
public void test0008() throws IOException {
String source =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = new Y()::<String>foo;\n" +
" i.foo(10); \n" +
" }\n" +
"}\n" +
"class Y {\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = new Y()::<String>foo;\n" +
" i.foo(10);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0008", expectedUnitToString);
}
// Reference expression - X<T>:: form, without type arguments.
public void test0009() throws IOException {
String source =
"interface I {\n" +
" void foo(Y<String> y, int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y<String>::foo;\n" +
" i.foo(new Y<String>(), 10); \n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(Y<String> y, int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y<String>::foo;\n" +
" i.foo(new Y<String>(), 10);\n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0009", expectedUnitToString);
}
// Reference expression - X<T>:: form, with type arguments.
public void test0010() throws IOException {
String source =
"interface I {\n" +
" void foo(Y<String> y, int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y<String>::<String>foo;\n" +
" i.foo(new Y<String>(), 10); \n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(Y<String> y, int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y<String>::<String>foo;\n" +
" i.foo(new Y<String>(), 10);\n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0010", expectedUnitToString);
}
// Reference expression - X<T>.Name:: form, without type arguments.
public void test0011() throws IOException {
String source =
"interface I {\n" +
" void foo(Y<String>.Z z, int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y<String>.Z::foo;\n" +
" i.foo(new Y<String>().new Z(), 10); \n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" class Z {\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(Y<String>.Z z, int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y<String>.Z::foo;\n" +
" i.foo(new Y<String>().new Z(), 10);\n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" class Z {\n" +
" Z() {\n" +
" super();\n" +
" }\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0011", expectedUnitToString);
}
// Reference expression - X<T>.Name:: form, with type arguments.
public void test0012() throws IOException {
String source =
"interface I {\n" +
" void foo(Y<String>.Z z, int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y<String>.Z::<String>foo;\n" +
" i.foo(new Y<String>().new Z(), 10); \n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" class Z {\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(Y<String>.Z z, int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y<String>.Z::<String>foo;\n" +
" i.foo(new Y<String>().new Z(), 10);\n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" class Z {\n" +
" Z() {\n" +
" super();\n" +
" }\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0012", expectedUnitToString);
}
// Reference expression - X<T>.Y<K>:: form, without type arguments.
public void test0013() throws IOException {
String source =
"interface I {\n" +
" void foo(Y<String>.Z<Integer> z, int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y<String>.Z<Integer>::foo;\n" +
" i.foo(new Y<String>().new Z<Integer>(), 10); \n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" class Z<K> {\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(Y<String>.Z<Integer> z, int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y<String>.Z<Integer>::foo;\n" +
" i.foo(new Y<String>().new Z<Integer>(), 10);\n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" class Z<K> {\n" +
" Z() {\n" +
" super();\n" +
" }\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0013", expectedUnitToString);
}
// Reference expression - X<T>.Y<K>:: form, with type arguments.
public void test0014() throws IOException {
String source =
"interface I {\n" +
" void foo(Y<String>.Z<Integer> z, int x);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y<String>.Z<Integer>::<String>foo;\n" +
" i.foo(new Y<String>().new Z<Integer>(), 10); \n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" class Z<K> {\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(Y<String>.Z<Integer> z, int x);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y<String>.Z<Integer>::<String>foo;\n" +
" i.foo(new Y<String>().new Z<Integer>(), 10);\n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" class Z<K> {\n" +
" Z() {\n" +
" super();\n" +
" }\n" +
" void foo(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
" }\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0014", expectedUnitToString);
}
// Constructor reference expression - X<T>.Y<K>::new form, with type arguments.
public void test0015() throws IOException {
String source =
"interface I {\n" +
" void foo(Y<String> y);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = Y<String>.Z<Integer>::<String>new;\n" +
" i.foo(new Y<String>()); \n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" class Z<K> {\n" +
" Z() {\n" +
" System.out.println(\"Y<T>.Z<K>::new\");\n" +
" }\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(Y<String> y);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = Y<String>.Z<Integer>::<String>new;\n" +
" i.foo(new Y<String>());\n" +
" }\n" +
"}\n" +
"class Y<T> {\n" +
" class Z<K> {\n" +
" Z() {\n" +
" super();\n" +
" System.out.println(\"Y<T>.Z<K>::new\");\n" +
" }\n" +
" }\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0015", expectedUnitToString);
}
// Reference expression - PrimitiveType[]:: form, with type arguments.
public void test0016() throws IOException {
String source =
"interface I {\n" +
" Object copy(int [] ia);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = int[]::<String>clone;\n" +
" i.copy(new int[10]); \n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" Object copy(int[] ia);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = int[]::<String>clone;\n" +
" i.copy(new int[10]);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0016", expectedUnitToString);
}
// Reference expression - Name[]:: form, with type arguments.
public void test0017() throws IOException {
String source =
"interface I {\n" +
" Object copy(X [] ia);\n" +
"}\n" +
"public class X {\n" +
" public static void main(String [] args) {\n" +
" I i = X[]::<String>clone;\n" +
" i.copy(new X[10]); \n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" Object copy(X[] ia);\n" +
"}\n" +
"public class X {\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = X[]::<String>clone;\n" +
" i.copy(new X[10]);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0017", expectedUnitToString);
}
// Reference expression - X<T>.Y<K>[]:: form, with type arguments.
public void test0018() throws IOException {
String source =
"interface I {\n" +
" Object copy(X<String>.Y<Integer> [] p);\n" +
"}\n" +
"public class X<T> {\n" +
" class Y<K> {\n" +
" }\n" +
" public static void main(String [] args) {\n" +
" I i = X<String>.Y<Integer>[]::<String>clone;\n" +
" X<String>.Y<Integer>[] xs = null;\n" +
" i.copy(xs); \n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" Object copy(X<String>.Y<Integer>[] p);\n" +
"}\n" +
"public class X<T> {\n" +
" class Y<K> {\n" +
" Y() {\n" +
" super();\n" +
" }\n" +
" }\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" I i = X<String>.Y<Integer>[]::<String>clone;\n" +
" X<String>.Y<Integer>[] xs = null;\n" +
" i.copy(xs);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0018", expectedUnitToString);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=384320, syntax error while mixing 308 and 335.
public void test0019() throws IOException {
String source =
"interface I {\n" +
" void foo(X<String> s, int x);\n" +
"}\n" +
"public class X<T> {\n" +
" I i = X<@Foo({\"hello\"}) String>::foo;\n" +
" void foo(int x) {\n" +
" }\n" +
"}\n" +
"@interface Foo {\n" +
" String [] value();\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo(X<String> s, int x);\n" +
"}\n" +
"public class X<T> {\n" +
" I i = X<@Foo({\"hello\"}) String>::foo;\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" void foo(int x) {\n" +
" }\n" +
"}\n" +
"@interface Foo {\n" +
" String[] value();\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0019", expectedUnitToString);
}
// Reference expression - Name::new forms, with/without type arguments.
public void test0020() throws IOException {
String source =
"interface I {\n" +
" Y foo(int x);\n" +
"}\n" +
"public class X {\n" +
" class Z extends Y {\n" +
" public Z(int x) {\n" +
" super(x);\n" +
" System.out.println(\"Z\"+x);\n" +
" }\n" +
" }\n" +
" public static void main(String [] args) {\n" +
" Y y;\n" +
" I i = Y::new;\n" +
" y = i.foo(10); \n" +
" i = X.Z::new;\n" +
" y = i.foo(20); \n" +
" i = W<Integer>::new;\n" +
" y = i.foo(23);\n" +
" }\n" +
"}\n" +
"class W<T> extends Y {\n" +
" public W(T x) {\n" +
" super(0);\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public Y(int x) {\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" Y foo(int x);\n" +
"}\n" +
"public class X {\n" +
" class Z extends Y {\n" +
" public Z(int x) {\n" +
" super(x);\n" +
" System.out.println((\"Z\" + x));\n" +
" }\n" +
" }\n" +
" public X() {\n" +
" super();\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" Y y;\n" +
" I i = Y::new;\n" +
" y = i.foo(10);\n" +
" i = X.Z::new;\n" +
" y = i.foo(20);\n" +
" i = W<Integer>::new;\n" +
" y = i.foo(23);\n" +
" }\n" +
"}\n" +
"class W<T> extends Y {\n" +
" public W(T x) {\n" +
" super(0);\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public Y(int x) {\n" +
" super();\n" +
" System.out.println(x);\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test0003", expectedUnitToString);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=385132
public void test385132() throws IOException {
String source = "::";
String expectedErrorString =
"----------\n" +
"1. ERROR in test385132 (at line 1)\n" +
" ::\n" +
" ^^\n" +
"Syntax error on token \"::\", delete this token\n" +
"----------\n";
checkParse(CHECK_PARSER , source.toCharArray(), expectedErrorString, "test385132", null);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=385374, Support for 308 style type annotations on 335 constructs.
public void test385374() throws IOException {
String source =
"interface I {\n" +
" void foo();\n" +
"}\n" +
"@interface TypeAnnotation {\n" +
"}\n" +
"\n" +
"class X<T> {\n" +
" // Primitive array form\n" +
" I x1 = @TypeAnnotation int []::clone;\n" +
" // Primitive array form with dimension annotations.\n" +
" I x2 = @TypeAnnotation int @ArrayAnnotation[]@ArrayAnnotation[]::clone; \n" +
" // Primitive array form with dimension annotations and type parameter annotations.\n" +
" I x3 = @TypeAnnotation int @ArrayAnnotation[]@ArrayAnnotation[]::<@TypeParameterAnnotation String>clone; \n" +
" // Reference type name form\n" +
" I x4 = @TypeAnnotation X::clone;\n" +
" // Reference type name array form\n" +
" I x5 = @TypeAnnotation X []::clone;\n" +
" // Reference type name array form with dimension annotations.\n" +
" I x6 = @TypeAnnotation X @ArrayAnnotation[]@ArrayAnnotation[]::clone; \n" +
" // Reference type name array form with dimension annotations and type parameter annotations.\n" +
" I x7 = @TypeAnnotation X @ArrayAnnotation[]@ArrayAnnotation[]::<@TypeParameterAnnotation String>clone; \n" +
" // Generic type array form with dimension annotations and type parameter annotations.\n" +
" I x8 = @TypeAnnotation X<@TypeParameterAnnotation String> @ArrayAnnotation[]@ArrayAnnotation[]::<@TypeParameterAnnotation String>clone; \n" +
" // Qualified generic type array form with dimension annotations and type parameter annotations.\n" +
" I x9 = @TypeAnnotation X<@TypeParameterAnnotation String>.Y<@TypeParameterAnnotation String> @ArrayAnnotation[]@ArrayAnnotation[]::<@TypeParameterAnnotation String>clone; \n" +
"}\n";
String expectedUnitToString =
"interface I {\n" +
" void foo();\n" +
"}\n" +
"@interface TypeAnnotation {\n" +
"}\n" +
"class X<T> {\n" +
" I x1 = @TypeAnnotation int[]::clone;\n" +
" I x2 = @TypeAnnotation int @ArrayAnnotation [] @ArrayAnnotation []::clone;\n" +
" I x3 = @TypeAnnotation int @ArrayAnnotation [] @ArrayAnnotation []::<@TypeParameterAnnotation String>clone;\n" +
" I x4 = @TypeAnnotation X::clone;\n" +
" I x5 = @TypeAnnotation X[]::clone;\n" +
" I x6 = @TypeAnnotation X @ArrayAnnotation [] @ArrayAnnotation []::clone;\n" +
" I x7 = @TypeAnnotation X @ArrayAnnotation [] @ArrayAnnotation []::<@TypeParameterAnnotation String>clone;\n" +
" I x8 = @TypeAnnotation X<@TypeParameterAnnotation String> @ArrayAnnotation [] @ArrayAnnotation []::<@TypeParameterAnnotation String>clone;\n" +
" I x9 = @TypeAnnotation X<@TypeParameterAnnotation String>.Y<@TypeParameterAnnotation String> @ArrayAnnotation [] @ArrayAnnotation []::<@TypeParameterAnnotation String>clone;\n" +
" X() {\n" +
" super();\n" +
" }\n" +
"}\n";
checkParse(CHECK_PARSER | CHECK_JAVAC_PARSER , source.toCharArray(), null, "test385374", expectedUnitToString);
}
/* https://bugs.eclipse.org/bugs/show_bug.cgi?id=385374, Support for 308 style type annotations on 335 constructs - make sure illegal modifiers are rejected
This test has been rendered meaningless as the grammar has been so throughly changed - Type annotations are not accepted via modifiers in the first place.
Disabling this test as we don't want fragile and unstable tests that are at the whimsy of the diagnose parser's complex algorithms.
*/
public void test385374a() throws IOException {
// Nop.
}
}
| 31,032
|
Java
|
.java
| 968
| 27.06095
| 185
| 0.490382
|
maxeler/eclipse
| 5
| 4
| 3
|
EPL-1.0
|
9/4/2024, 10:35:19 PM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| true
| true
| 31,032
|
1,319,009
|
A_test707.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/return_in/A_test707.java
|
package return_in;
public class A_test707 {
boolean flag;
public boolean foo() {
/*[*/target: {
do {
if (flag)
break target;
return false;
} while (flag);
}
return true;/*]*/
}
}
| 208
|
Java
|
.java
| 14
| 11.785714
| 24
| 0.601036
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 208
|
1,315,630
|
A.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/UseSupertypeWherePossible/test18/out/A.java
|
package p;
class A implements I {
public void m(){}
public void m1(){}
void f(){
I a= new A();
a.m();
A a1= new A();
a1.m1();
}
}
| 143
|
Java
|
.java
| 11
| 10.818182
| 22
| 0.549618
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 143
|
3,728,202
|
TestCollisionShapeFactory.java
|
SteveSmith16384_AresDogfighter/jme_source/jme3test/bullet/TestCollisionShapeFactory.java
|
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jme3test.bullet;
import com.jme3.app.SimpleApplication;
import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.PhysicsSpace;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Quaternion;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Box;
import com.jme3.scene.shape.Cylinder;
import com.jme3.scene.shape.Torus;
/**
* This is a basic Test of jbullet-jme functions
*
* @author normenhansen
*/
public class TestCollisionShapeFactory extends SimpleApplication {
private BulletAppState bulletAppState;
private Material mat1;
private Material mat2;
private Material mat3;
public static void main(String[] args) {
TestCollisionShapeFactory app = new TestCollisionShapeFactory();
app.start();
}
@Override
public void simpleInitApp() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
bulletAppState.getPhysicsSpace().enableDebug(assetManager);
createMaterial();
Node node = new Node("node1");
attachRandomGeometry(node, mat1);
randomizeTransform(node);
Node node2 = new Node("node2");
attachRandomGeometry(node2, mat2);
randomizeTransform(node2);
node.attachChild(node2);
rootNode.attachChild(node);
RigidBodyControl control = new RigidBodyControl(0);
node.addControl(control);
getPhysicsSpace().add(control);
//test single geometry too
Geometry myGeom = new Geometry("cylinder", new Cylinder(16, 16, 0.5f, 1));
myGeom.setMaterial(mat3);
randomizeTransform(myGeom);
rootNode.attachChild(myGeom);
RigidBodyControl control3 = new RigidBodyControl(0);
myGeom.addControl(control3);
getPhysicsSpace().add(control3);
}
private void attachRandomGeometry(Node node, Material mat) {
Box box = new Box(0.25f, 0.25f, 0.25f);
Torus torus = new Torus(16, 16, 0.2f, 0.8f);
Geometry[] boxes = new Geometry[]{
new Geometry("box1", box),
new Geometry("box2", box),
new Geometry("box3", box),
new Geometry("torus1", torus),
new Geometry("torus2", torus),
new Geometry("torus3", torus)
};
for (int i = 0; i < boxes.length; i++) {
Geometry geometry = boxes[i];
geometry.setLocalTranslation((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10);
geometry.setLocalRotation(new Quaternion().fromAngles((float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI));
geometry.setLocalScale((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10);
geometry.setMaterial(mat);
node.attachChild(geometry);
}
}
private void randomizeTransform(Spatial spat){
spat.setLocalTranslation((float) Math.random() * 10, (float) Math.random() * 10, (float) Math.random() * 10);
spat.setLocalTranslation((float) Math.random() * 10, (float) Math.random() * 10, (float) Math.random() * 10);
spat.setLocalScale((float) Math.random() * 2, (float) Math.random() * 2, (float) Math.random() * 2);
}
private void createMaterial() {
mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor("Color", ColorRGBA.Green);
mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat2.setColor("Color", ColorRGBA.Red);
mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat3.setColor("Color", ColorRGBA.Yellow);
}
private PhysicsSpace getPhysicsSpace() {
return bulletAppState.getPhysicsSpace();
}
}
| 5,602
|
Java
|
.java
| 123
| 39.764228
| 178
| 0.701189
|
SteveSmith16384/AresDogfighter
| 3
| 0
| 0
|
GPL-3.0
|
9/4/2024, 11:40:04 PM (Europe/Amsterdam)
| false
| true
| true
| true
| true
| true
| true
| true
| 5,602
|
4,949,409
|
ParcelableCompat.java
|
Dewep_IntranetEpitechV2/Android/android.support.v4/src/java/android/support/v4/os/ParcelableCompat.java
|
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.support.v4.os;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Helper for accessing features in {@link android.os.Parcelable}
* introduced after API level 4 in a backwards compatible fashion.
*/
public class ParcelableCompat {
/**
* Factory method for {@link Parcelable.Creator}.
*
* @param callbacks Creator callbacks implementation.
* @return New creator.
*/
public static <T> Parcelable.Creator<T> newCreator(
ParcelableCompatCreatorCallbacks<T> callbacks) {
if (android.os.Build.VERSION.SDK_INT >= 13) {
ParcelableCompatCreatorHoneycombMR2Stub.instantiate(callbacks);
}
return new CompatCreator<T>(callbacks);
}
static class CompatCreator<T> implements Parcelable.Creator<T> {
final ParcelableCompatCreatorCallbacks<T> mCallbacks;
public CompatCreator(ParcelableCompatCreatorCallbacks<T> callbacks) {
mCallbacks = callbacks;
}
@Override
public T createFromParcel(Parcel source) {
return mCallbacks.createFromParcel(source, null);
}
@Override
public T[] newArray(int size) {
return mCallbacks.newArray(size);
}
}
}
| 1,880
|
Java
|
.java
| 51
| 31.431373
| 77
| 0.705656
|
Dewep/IntranetEpitechV2
| 1
| 0
| 0
|
GPL-3.0
|
9/5/2024, 12:36:54 AM (Europe/Amsterdam)
| true
| true
| true
| true
| true
| true
| true
| true
| 1,880
|
4,949,466
|
NotificationCompatApi21.java
|
Dewep_IntranetEpitechV2/Android/android.support.v4/src/api21/android/support/v4/app/NotificationCompatApi21.java
|
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.support.v4.app;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Parcelable;
import android.widget.RemoteViews;
import java.util.ArrayList;
class NotificationCompatApi21 {
public static final String CATEGORY_CALL = Notification.CATEGORY_CALL;
public static final String CATEGORY_MESSAGE = Notification.CATEGORY_MESSAGE;
public static final String CATEGORY_EMAIL = Notification.CATEGORY_EMAIL;
public static final String CATEGORY_EVENT = Notification.CATEGORY_EVENT;
public static final String CATEGORY_PROMO = Notification.CATEGORY_PROMO;
public static final String CATEGORY_ALARM = Notification.CATEGORY_ALARM;
public static final String CATEGORY_PROGRESS = Notification.CATEGORY_PROGRESS;
public static final String CATEGORY_SOCIAL = Notification.CATEGORY_SOCIAL;
public static final String CATEGORY_ERROR = Notification.CATEGORY_ERROR;
public static final String CATEGORY_TRANSPORT = Notification.CATEGORY_TRANSPORT;
public static final String CATEGORY_SYSTEM = Notification.CATEGORY_SYSTEM;
public static final String CATEGORY_SERVICE = Notification.CATEGORY_SERVICE;
public static final String CATEGORY_RECOMMENDATION = Notification.CATEGORY_RECOMMENDATION;
public static final String CATEGORY_STATUS = Notification.CATEGORY_STATUS;
private static final String KEY_AUTHOR = "author";
private static final String KEY_TEXT = "text";
private static final String KEY_MESSAGES = "messages";
private static final String KEY_REMOTE_INPUT = "remote_input";
private static final String KEY_ON_REPLY = "on_reply";
private static final String KEY_ON_READ = "on_read";
private static final String KEY_PARTICIPANTS = "participants";
private static final String KEY_TIMESTAMP = "timestamp";
public static class Builder implements NotificationBuilderWithBuilderAccessor,
NotificationBuilderWithActions {
private Notification.Builder b;
public Builder(Context context, Notification n,
CharSequence contentTitle, CharSequence contentText, CharSequence contentInfo,
RemoteViews tickerView, int number,
PendingIntent contentIntent, PendingIntent fullScreenIntent, Bitmap largeIcon,
int progressMax, int progress, boolean progressIndeterminate, boolean showWhen,
boolean useChronometer, int priority, CharSequence subText, boolean localOnly,
String category, ArrayList<String> people, Bundle extras, int color,
int visibility, Notification publicVersion, String groupKey, boolean groupSummary,
String sortKey) {
b = new Notification.Builder(context)
.setWhen(n.when)
.setShowWhen(showWhen)
.setSmallIcon(n.icon, n.iconLevel)
.setContent(n.contentView)
.setTicker(n.tickerText, tickerView)
.setSound(n.sound, n.audioStreamType)
.setVibrate(n.vibrate)
.setLights(n.ledARGB, n.ledOnMS, n.ledOffMS)
.setOngoing((n.flags & Notification.FLAG_ONGOING_EVENT) != 0)
.setOnlyAlertOnce((n.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0)
.setAutoCancel((n.flags & Notification.FLAG_AUTO_CANCEL) != 0)
.setDefaults(n.defaults)
.setContentTitle(contentTitle)
.setContentText(contentText)
.setSubText(subText)
.setContentInfo(contentInfo)
.setContentIntent(contentIntent)
.setDeleteIntent(n.deleteIntent)
.setFullScreenIntent(fullScreenIntent,
(n.flags & Notification.FLAG_HIGH_PRIORITY) != 0)
.setLargeIcon(largeIcon)
.setNumber(number)
.setUsesChronometer(useChronometer)
.setPriority(priority)
.setProgress(progressMax, progress, progressIndeterminate)
.setLocalOnly(localOnly)
.setExtras(extras)
.setGroup(groupKey)
.setGroupSummary(groupSummary)
.setSortKey(sortKey)
.setCategory(category)
.setColor(color)
.setVisibility(visibility)
.setPublicVersion(publicVersion);
for (String person: people) {
b.addPerson(person);
}
}
@Override
public void addAction(NotificationCompatBase.Action action) {
NotificationCompatApi20.addAction(b, action);
}
@Override
public Notification.Builder getBuilder() {
return b;
}
public Notification build() {
return b.build();
}
}
public static String getCategory(Notification notif) {
return notif.category;
}
static Bundle getBundleForUnreadConversation(NotificationCompatBase.UnreadConversation uc) {
if (uc == null) {
return null;
}
Bundle b = new Bundle();
String author = null;
if (uc.getParticipants() != null && uc.getParticipants().length > 1) {
author = uc.getParticipants()[0];
}
Parcelable[] messages = new Parcelable[uc.getMessages().length];
for (int i = 0; i < messages.length; i++) {
Bundle m = new Bundle();
m.putString(KEY_TEXT, uc.getMessages()[i]);
m.putString(KEY_AUTHOR, author);
messages[i] = m;
}
b.putParcelableArray(KEY_MESSAGES, messages);
RemoteInputCompatBase.RemoteInput remoteInput = uc.getRemoteInput();
if (remoteInput != null) {
b.putParcelable(KEY_REMOTE_INPUT, fromCompatRemoteInput(remoteInput));
}
b.putParcelable(KEY_ON_REPLY, uc.getReplyPendingIntent());
b.putParcelable(KEY_ON_READ, uc.getReadPendingIntent());
b.putStringArray(KEY_PARTICIPANTS, uc.getParticipants());
b.putLong(KEY_TIMESTAMP, uc.getLatestTimestamp());
return b;
}
static NotificationCompatBase.UnreadConversation getUnreadConversationFromBundle(
Bundle b, NotificationCompatBase.UnreadConversation.Factory factory,
RemoteInputCompatBase.RemoteInput.Factory remoteInputFactory) {
if (b == null) {
return null;
}
Parcelable[] parcelableMessages = b.getParcelableArray(KEY_MESSAGES);
String[] messages = null;
if (parcelableMessages != null) {
String[] tmp = new String[parcelableMessages.length];
boolean success = true;
for (int i = 0; i < tmp.length; i++) {
if (!(parcelableMessages[i] instanceof Bundle)) {
success = false;
break;
}
tmp[i] = ((Bundle) parcelableMessages[i]).getString(KEY_TEXT);
if (tmp[i] == null) {
success = false;
break;
}
}
if (success) {
messages = tmp;
} else {
return null;
}
}
PendingIntent onRead = b.getParcelable(KEY_ON_READ);
PendingIntent onReply = b.getParcelable(KEY_ON_REPLY);
android.app.RemoteInput remoteInput = b.getParcelable(KEY_REMOTE_INPUT);
String[] participants = b.getStringArray(KEY_PARTICIPANTS);
if (participants == null || participants.length != 1) {
return null;
}
return factory.build(
messages,
remoteInput != null ? toCompatRemoteInput(remoteInput, remoteInputFactory) : null,
onReply,
onRead,
participants, b.getLong(KEY_TIMESTAMP));
}
private static android.app.RemoteInput fromCompatRemoteInput(
RemoteInputCompatBase.RemoteInput src) {
return new android.app.RemoteInput.Builder(src.getResultKey())
.setLabel(src.getLabel())
.setChoices(src.getChoices())
.setAllowFreeFormInput(src.getAllowFreeFormInput())
.addExtras(src.getExtras())
.build();
}
private static RemoteInputCompatBase.RemoteInput toCompatRemoteInput(
android.app.RemoteInput remoteInput,
RemoteInputCompatBase.RemoteInput.Factory factory) {
return factory.build(remoteInput.getResultKey(),
remoteInput.getLabel(),
remoteInput.getChoices(),
remoteInput.getAllowFreeFormInput(),
remoteInput.getExtras());
}
}
| 9,608
|
Java
|
.java
| 201
| 36.278607
| 98
| 0.635628
|
Dewep/IntranetEpitechV2
| 1
| 0
| 0
|
GPL-3.0
|
9/5/2024, 12:36:54 AM (Europe/Amsterdam)
| true
| true
| true
| true
| true
| true
| true
| true
| 9,608
|
1,319,938
|
TestNoException.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/SurroundWithWorkSpace/SurroundWithTests/trycatch_out/TestNoException.java
|
package trycatch_in;
public class TestNoException {
public void foo() {
/*]*/try {
foo();
} catch (Exception e) {
}/*[*/
}
}
| 137
|
Java
|
.java
| 9
| 12.888889
| 30
| 0.606299
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 137
|
3,019,899
|
PostRepository.java
|
Karambasss_Finashka/fa-blog_Kuznetsov_all/blog/src/main/java/com/example/blog/repository/PostRepository.java
|
package com.example.blog.repository;
import com.example.blog.entity.Post;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PostRepository extends JpaRepository<Post, Long> {
}
| 208
|
Java
|
.java
| 5
| 40.2
| 67
| 0.855721
|
Karambasss/Finashka
| 5
| 2
| 3
|
GPL-3.0
|
9/4/2024, 10:42:50 PM (Europe/Amsterdam)
| false
| true
| false
| true
| false
| true
| true
| true
| 208
|
1,317,125
|
A.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/RenameType/test23/in/A.java
|
package p;
class A{
A[] a = new A[5];
}
| 42
|
Java
|
.java
| 4
| 9
| 19
| 0.552632
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 42
|
4,212,306
|
ExceptionStrategy.java
|
michele-loreti_jResp/core/org.cmg.jresp.pastry/pastry-2.1/src/rice/environment/exception/ExceptionStrategy.java
|
/*******************************************************************************
"FreePastry" Peer-to-Peer Application Development Substrate
Copyright 2002-2007, Rice University. Copyright 2006-2007, Max Planck Institute
for Software Systems. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Rice University (RICE), Max Planck Institute for Software
Systems (MPI-SWS) nor the names of its contributors may be used to endorse or
promote products derived from this software without specific prior written
permission.
This software is provided by RICE, MPI-SWS and the contributors on an "as is"
basis, without any representations or warranties of any kind, express or implied
including, but not limited to, representations or warranties of
non-infringement, merchantability or fitness for a particular purpose. In no
event shall RICE, MPI-SWS or contributors be liable for any direct, indirect,
incidental, special, exemplary, or consequential damages (including, but not
limited to, procurement of substitute goods or services; loss of use, data, or
profits; or business interruption) however caused and on any theory of
liability, whether in contract, strict liability, or tort (including negligence
or otherwise) arising in any way out of the use of this software, even if
advised of the possibility of such damage.
*******************************************************************************/
/*
* Created on Jan 8, 2007
*/
package rice.environment.exception;
import rice.selector.SelectorManager;
public interface ExceptionStrategy {
void handleException(Object source, Throwable t);
}
| 2,093
|
Java
|
.java
| 36
| 56.305556
| 81
| 0.756968
|
michele-loreti/jResp
| 2
| 0
| 5
|
EPL-1.0
|
9/5/2024, 12:05:57 AM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 2,093
|
2,193,569
|
BlockPrismarine.java
|
Cats-Club_Impact-3_0/net/minecraft/block/BlockPrismarine.java
|
package net.minecraft.block;
import java.util.List;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.text.translation.I18n;
public class BlockPrismarine extends Block
{
public static final PropertyEnum<BlockPrismarine.EnumType> VARIANT = PropertyEnum.<BlockPrismarine.EnumType>create("variant", BlockPrismarine.EnumType.class);
public static final int ROUGH_META = BlockPrismarine.EnumType.ROUGH.getMetadata();
public static final int BRICKS_META = BlockPrismarine.EnumType.BRICKS.getMetadata();
public static final int DARK_META = BlockPrismarine.EnumType.DARK.getMetadata();
public BlockPrismarine()
{
super(Material.ROCK);
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockPrismarine.EnumType.ROUGH));
this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
}
/**
* Gets the localized name of this block. Used for the statistics page.
*/
public String getLocalizedName()
{
return I18n.translateToLocal(this.getUnlocalizedName() + "." + BlockPrismarine.EnumType.ROUGH.getUnlocalizedName() + ".name");
}
/**
* Get the MapColor for this Block and the given BlockState
*/
public MapColor getMapColor(IBlockState state)
{
return state.getValue(VARIANT) == BlockPrismarine.EnumType.ROUGH ? MapColor.CYAN : MapColor.DIAMOND;
}
/**
* Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
* returns the metadata of the dropped item based on the old metadata of the block.
*/
public int damageDropped(IBlockState state)
{
return ((BlockPrismarine.EnumType)state.getValue(VARIANT)).getMetadata();
}
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state)
{
return ((BlockPrismarine.EnumType)state.getValue(VARIANT)).getMetadata();
}
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {VARIANT});
}
/**
* Convert the given metadata into a BlockState for this Block
*/
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(VARIANT, BlockPrismarine.EnumType.byMetadata(meta));
}
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
{
list.add(new ItemStack(itemIn, 1, ROUGH_META));
list.add(new ItemStack(itemIn, 1, BRICKS_META));
list.add(new ItemStack(itemIn, 1, DARK_META));
}
public static enum EnumType implements IStringSerializable
{
ROUGH(0, "prismarine", "rough"),
BRICKS(1, "prismarine_bricks", "bricks"),
DARK(2, "dark_prismarine", "dark");
private static final BlockPrismarine.EnumType[] META_LOOKUP = new BlockPrismarine.EnumType[values().length];
private final int meta;
private final String name;
private final String unlocalizedName;
private EnumType(int meta, String name, String unlocalizedName)
{
this.meta = meta;
this.name = name;
this.unlocalizedName = unlocalizedName;
}
public int getMetadata()
{
return this.meta;
}
public String toString()
{
return this.name;
}
public static BlockPrismarine.EnumType byMetadata(int meta)
{
if (meta < 0 || meta >= META_LOOKUP.length)
{
meta = 0;
}
return META_LOOKUP[meta];
}
public String getName()
{
return this.name;
}
public String getUnlocalizedName()
{
return this.unlocalizedName;
}
static {
for (BlockPrismarine.EnumType blockprismarine$enumtype : values())
{
META_LOOKUP[blockprismarine$enumtype.getMetadata()] = blockprismarine$enumtype;
}
}
}
}
| 4,629
|
Java
|
.java
| 121
| 31.099174
| 162
| 0.682264
|
Cats-Club/Impact-3.0
| 19
| 1
| 0
|
MPL-2.0
|
9/4/2024, 8:32:05 PM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| true
| true
| 4,629
|
1,449,472
|
RemoveAdapters2.java
|
abiswas-odu_Disco/bbmap/current/pacbio/RemoveAdapters2.java
|
package pacbio;
import java.util.ArrayList;
import java.util.Locale;
import align2.MultiStateAligner9PacBioAdapter;
import align2.MultiStateAligner9PacBioAdapter2;
import dna.AminoAcid;
import dna.Data;
import fileIO.FileFormat;
import fileIO.ReadWrite;
import shared.KillSwitch;
import shared.Parser;
import shared.PreParser;
import shared.ReadStats;
import shared.Shared;
import shared.Timer;
import shared.Tools;
import stream.ConcurrentReadInputStream;
import stream.ConcurrentReadOutputStream;
import stream.FastaReadInputStream;
import stream.Read;
import structures.ListNum;
/**
* Increased sensitivity to nearby adapters.
* @author Brian Bushnell
* @date Nov 5, 2012
*
*/
public class RemoveAdapters2 {
public static void main(String[] args){
{//Preparse block for help, config files, and outstream
PreParser pp=new PreParser(args, new Object() { }.getClass().getEnclosingClass(), false);
args=pp.args;
//outstream=pp.outstream;
}
boolean verbose=false;
String in1=null;
String in2=null;
long maxReads=-1;
String outname1=null;
String outname2=null;
String query=pacbioAdapter;
Shared.capBufferLen(20);
boolean splitReads=true;
for(int i=0; i<args.length; i++){
final String arg=args[i];
final String[] split=arg.split("=");
String a=split[0].toLowerCase();
String b=split.length>1 ? split[1] : null;
if(Parser.parseCommonStatic(arg, a, b)){
//do nothing
}else if(Parser.parseZip(arg, a, b)){
//do nothing
}else if(Parser.parseQuality(arg, a, b)){
//do nothing
}else if(Parser.parseFasta(arg, a, b)){
//do nothing
}else if(a.equals("path") || a.equals("root") || a.equals("tempdir")){
Data.setPath(b);
}else if(a.equals("fasta") || a.equals("in") || a.equals("input") || a.equals("in1") || a.equals("input1")){
in1=b;
if(b.indexOf('#')>-1){
in1=b.replace("#", "1");
in2=b.replace("#", "2");
}
}else if(a.equals("in2") || a.equals("input2")){
in2=b;
}else if(a.equals("query") || a.equals("adapter")){
query=b;
}else if(a.equals("split")){
splitReads=Tools.parseBoolean(b);
}else if(a.equals("plusonly")){
boolean x=Tools.parseBoolean(b);
if(x){TRY_PLUS=true; TRY_MINUS=false;}
}else if(a.equals("minusonly")){
boolean x=Tools.parseBoolean(b);
if(x){TRY_PLUS=false; TRY_MINUS=true;}
}else if(a.startsWith("mincontig")){
minContig=Integer.parseInt(b);
}else if(a.equals("append") || a.equals("app")){
append=ReadStats.append=Tools.parseBoolean(b);
}else if(a.equals("overwrite") || a.equals("ow")){
overwrite=Tools.parseBoolean(b);
System.out.println("Set overwrite to "+overwrite);
}else if(a.equals("threads") || a.equals("t")){
if(b.equalsIgnoreCase("auto")){THREADS=Shared.LOGICAL_PROCESSORS;}
else{THREADS=Integer.parseInt(b);}
System.out.println("Set threads to "+THREADS);
}else if(a.equals("reads") || a.equals("maxreads")){
maxReads=Tools.parseKMG(b);
}else if(a.startsWith("outname") || a.startsWith("outfile") || a.equals("out")){
if(b==null || b.equalsIgnoreCase("null") || b.equalsIgnoreCase("none") || split.length==1){
System.out.println("No output file.");
outname1=null;
OUTPUT_READS=false;
}else{
OUTPUT_READS=true;
if(b.indexOf('#')>-1){
outname1=b.replace('#', '1');
outname2=b.replace('#', '2');
}else{
outname1=b;
}
}
}else if(a.equals("minratio")){
MINIMUM_ALIGNMENT_SCORE_RATIO=Float.parseFloat(b);
System.out.println("Set MINIMUM_ALIGNMENT_SCORE_RATIO to "+MINIMUM_ALIGNMENT_SCORE_RATIO);
}else if(a.equals("suspectratio")){
SUSPECT_RATIO=Float.parseFloat(b);
}else if(a.startsWith("verbose")){
verbose=Tools.parseBoolean(b);
}else{
throw new RuntimeException("Unknown parameter: "+args[i]);
}
}
{//Process parser fields
Parser.processQuality();
}
assert(FastaReadInputStream.settingsOK());
if(in1==null){throw new RuntimeException("Please specify input file.");}
final ConcurrentReadInputStream cris;
{
FileFormat ff1=FileFormat.testInput(in1, FileFormat.FASTQ, null, true, true);
FileFormat ff2=FileFormat.testInput(in2, FileFormat.FASTQ, null, true, true);
cris=ConcurrentReadInputStream.getReadInputStream(maxReads, true, ff1, ff2);
// if(verbose){System.err.println("Started cris");}
// cris.start(); //4567
// th.start();
}
boolean paired=cris.paired();
if(verbose){System.err.println("Paired: "+paired);}
ConcurrentReadOutputStream ros=null;
if(OUTPUT_READS){
final int buff=(!ordered ? THREADS : Tools.max(24, 2*THREADS));
FileFormat ff1=FileFormat.testOutput(outname1, FileFormat.FASTQ, null, true, overwrite, append, ordered);
FileFormat ff2=FileFormat.testOutput(outname2, FileFormat.FASTQ, null, true, overwrite, append, ordered);
ros=ConcurrentReadOutputStream.getStream(ff1, ff2, buff, null, true);
}
process(cris, ros, query, splitReads);
}
public static void process(ConcurrentReadInputStream cris, ConcurrentReadOutputStream ros, String query, boolean split){
Timer t=new Timer();
cris.start(); //4567
System.out.println("Started read stream.");
if(ros!=null){
ros.start();
System.out.println("Started output threads.");
}
ProcessThread[] pts=new ProcessThread[THREADS];
for(int i=0; i<pts.length; i++){
pts[i]=new ProcessThread(cris, ros, MINIMUM_ALIGNMENT_SCORE_RATIO, query, split);
pts[i].start();
}
System.out.println("Started "+pts.length+" processing thread"+(pts.length==1 ? "" : "s")+".");
for(int i=0; i<pts.length; i++){
ProcessThread pt=pts[i];
synchronized(pt){
while(pt.getState()!=Thread.State.TERMINATED){
try {
pt.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
if(i==0){
System.out.print("Detecting finished threads: 0");
}else{
System.out.print(", "+i);
}
}
System.out.println('\n');
ReadWrite.closeStreams(cris, ros);
printStatistics(pts);
t.stop();
System.out.println("Time: \t"+t);
}
public static void printStatistics(ProcessThread[] pts){
long plusAdaptersFound=0;
long minusAdaptersFound=0;
long goodReadsFound=0;
long badReadsFound=0;
long truepositive=0;
long truenegative=0;
long falsepositive=0;
long falsenegative=0;
long expected=0;
long unexpected=0;
long basesIn=0;
long basesOut=0;
long readsOut=0;
for(ProcessThread pt : pts){
plusAdaptersFound+=pt.plusAdaptersFound;
minusAdaptersFound+=pt.minusAdaptersFound;
goodReadsFound+=pt.goodReadsFound;
badReadsFound+=pt.badReadsFound;
basesIn+=pt.basesIn;
basesOut+=pt.basesOut;
readsOut+=pt.readsOut;
truepositive+=pt.truepositive;
truenegative+=pt.truenegative;
falsepositive+=pt.falsepositive;
falsenegative+=pt.falsenegative;
expected+=pt.expected;
unexpected+=pt.unexpected;
}
long totalReads=goodReadsFound+badReadsFound;
long totalAdapters=plusAdaptersFound+minusAdaptersFound;
if(expected<1){expected=1;}
if(unexpected<1){unexpected=1;}
System.out.println("Reads In: \t"+totalReads+" \t("+basesIn+" bases, avg length "+(basesIn/totalReads)+")");
System.out.println("Good reads: \t"+goodReadsFound);
System.out.println("Bad reads: \t"+badReadsFound+" \t("+totalAdapters+" adapters)");
System.out.println("Plus adapters: \t"+plusAdaptersFound);
System.out.println("Minus adapters: \t"+minusAdaptersFound);
System.out.println("Adapters per megabase: \t"+String.format(Locale.ROOT, "%.3f",totalAdapters*1000000f/basesIn));
if(readsOut>0){System.out.println("Reads Out: \t"+readsOut+" \t("+basesOut+" bases, avg length "+(basesOut/readsOut)+")");}
System.out.println();
if(truepositive>0 || truenegative>0 || falsepositive>0 || falsenegative>0){
System.out.println("Adapters Expected: \t"+expected);
System.out.println("True Positive: \t"+truepositive+" \t"+String.format(Locale.ROOT, "%.3f%%", truepositive*100f/expected));
System.out.println("True Negative: \t"+truenegative+" \t"+String.format(Locale.ROOT, "%.3f%%", truenegative*100f/unexpected));
System.out.println("False Positive: \t"+falsepositive+" \t"+String.format(Locale.ROOT, "%.3f%%", falsepositive*100f/unexpected));
System.out.println("False Negative: \t"+falsenegative+" \t"+String.format(Locale.ROOT, "%.3f%%", falsenegative*100f/expected));
}
}
private static class ProcessThread extends Thread{
public ProcessThread(ConcurrentReadInputStream cris_,
ConcurrentReadOutputStream ros_, float minRatio_, String query_, boolean split_) {
cris=cris_;
ros=ros_;
minRatio=minRatio_;
query1=query_.getBytes();
query2=AminoAcid.reverseComplementBases(query1);
ALIGN_ROWS=query1.length+1;
ALIGN_COLUMNS=ALIGN_ROWS*3+20;
SPLIT=split_;
stride=(int)(query1.length*0.95f);
window=(int)(query1.length*2.5f+10);
assert(window<ALIGN_COLUMNS);
msa=new MultiStateAligner9PacBioAdapter(ALIGN_ROWS, ALIGN_COLUMNS);
msa2=USE_ALT_MSA ? new MultiStateAligner9PacBioAdapter2(ALIGN_ROWS, ALIGN_COLUMNS) : null;
maxSwScore=msa.maxQuality(query1.length);
minSwScore=(int)(maxSwScore*MINIMUM_ALIGNMENT_SCORE_RATIO);
minSwScoreSuspect=(int)(maxSwScore*Tools.min(MINIMUM_ALIGNMENT_SCORE_RATIO*SUSPECT_RATIO, MINIMUM_ALIGNMENT_SCORE_RATIO-((1-SUSPECT_RATIO)*.2f)));
maxImperfectSwScore=msa.maxImperfectScore(query1.length);
suspectMidpoint=(minSwScoreSuspect+minSwScore)/2;
}
@Override
public void run(){
ListNum<Read> ln=cris.nextList();
ArrayList<Read> readlist=ln.list;
while(!readlist.isEmpty()){
//System.err.println("Got a list of size "+readlist.size());
for(int i=0; i<readlist.size(); i++){
Read r=readlist.get(i);
if(r.length()<minContig && (r.mate==null || r.mateLength()<minContig)){
readlist.set(i, null);
}else{
//System.out.println("Got read: "+r.toText());
//System.out.println("Synthetic: "+r.synthetic());
if(r.synthetic()){syntheticReads++;}
processRead(r);
if(r.mate!=null){processRead(r.mate);}
}
}
// System.err.println("outputStream = "+outputStream==null ? "null" : "real");
if(ros!=null){ //Important to send all lists to output, even empty ones, to keep list IDs straight.
if(DONT_OUTPUT_BROKEN_READS){removeDiscarded(readlist);}
for(Read r : readlist){
if(r!=null){
r.obj=null;
assert(r.bases!=null);
if(r.sites!=null && r.sites.isEmpty()){r.sites=null;}
}
}
// System.err.println("Adding list of length "+readlist.size());
ArrayList<Read> out=SPLIT ? split(readlist) : readlist;
for(Read r : out){
if(r!=null){
Read r2=r.mate;
basesOut+=r.length();
readsOut++;
if(r2!=null){
basesOut+=r2.length();
readsOut++;
}
}
}
ros.add(out, ln.id);
}
cris.returnList(ln.id, readlist.isEmpty());
//System.err.println("Waiting on a list...");
ln=cris.nextList();
readlist=ln.list;
}
//System.err.println("Returning a list... (final)");
assert(readlist.isEmpty());
cris.returnList(ln.id, readlist.isEmpty());
}
/**
* @param readlist
* @return
*/
private static ArrayList<Read> split(ArrayList<Read> in) {
ArrayList<Read> out=new ArrayList<Read>(in.size());
for(Read r : in){
if(r!=null){
// assert(r.mate==null);
if(!r.hasadapter()){out.add(r);}
else{out.addAll(split(r));}
Read r2=r.mate;
if(r2!=null){
if(!r2.hasadapter()){out.add(r2);}
else{out.addAll(split(r2));}
}
}
}
return out;
}
/**
* @param r
* @return
*/
private static ArrayList<Read> split(Read r) {
ArrayList<Read> sections=new ArrayList<Read>();
int lastX=-1;
for(int i=0; i<r.length(); i++){
if(r.bases[i]=='X'){
if(i-lastX>minContig){
byte[] b=KillSwitch.copyOfRange(r.bases, lastX+1, i);
byte[] q=r.quality==null ? null : KillSwitch.copyOfRange(r.quality, lastX+1, i);
Read r2=new Read(b, q, r.id+"_"+(lastX+1), r.numericID);
sections.add(r2);
}
lastX=i;
}
}
int i=r.length();
if(i-lastX>minContig){
byte[] b=KillSwitch.copyOfRange(r.bases, lastX+1, i);
byte[] q=r.quality==null ? null : KillSwitch.copyOfRange(r.quality, lastX+1, i);
Read r2=new Read(b, q, r.id+"_"+(lastX+1), r.numericID);
sections.add(r2);
}
return sections;
}
/**
* @param r
*/
private int processRead(Read r) {
int begin=0;
while(begin<r.length() && r.bases[begin]=='N'){begin++;} //Skip reads made of 'N'
if(begin>=r.length()){return 0;}
basesIn+=r.length();
final byte[] array=npad(r.bases, npad);
int lim=array.length-npad-stride;
int plusFound=0;
int minusFound=0;
int lastSuspect=-1;
int lastConfirmed=-1;
for(int i=begin; i<lim; i+=stride){
int j=Tools.min(i+window, array.length-1);
if(j-i<window){
lim=0; //Last loop cycle
// i=Tools.max(0, array.length-2*query1.length);
}
if(TRY_MINUS){
int[] rvec=msa.fillAndScoreLimited(query2, array, i, j, minSwScoreSuspect);
if(rvec!=null && rvec[0]>=minSwScoreSuspect){
int score=rvec[0];
int start=rvec[1];
int stop=rvec[2];
assert(score>=minSwScoreSuspect);
if((i==0 || start>i) && (j==array.length-1 || stop<j)){
boolean kill=(score>=minSwScore ||
(score>=suspectMidpoint && lastSuspect>0 && start>=lastSuspect && start-lastSuspect<suspectDistance) ||
(lastConfirmed>0 && start>=lastConfirmed && start-lastConfirmed<suspectDistance));
if(!kill && USE_LOCALITY && array.length-stop>window){//Look ahead
rvec=msa.fillAndScoreLimited(query2, array, stop, stop+window, minSwScoreSuspect);
if(rvec!=null){
if(score>=suspectMidpoint && rvec[0]>=minSwScoreSuspect && rvec[1]-stop<suspectDistance){kill=true;}
else if(score>=minSwScoreSuspect && rvec[0]>=minSwScore && rvec[1]-stop<suspectDistance){kill=true;}
}
}
if(!kill && USE_ALT_MSA){//Try alternate msa
rvec=msa2.fillAndScoreLimited(query2, array, Tools.max(0, start-4), Tools.min(stop+4, array.length-1), minSwScoreSuspect);
if(rvec!=null && rvec[0]>=(minSwScore)){kill=true;}
}
if(kill){
// System.out.println("-:"+score+", "+minSwScore+", "+minSwScoreSuspect+"\t"+lastSuspect+", "+start+", "+stop);
minusFound++;
for(int x=Tools.max(0, start); x<=stop; x++){array[x]='X';}
if(USE_LOCALITY && score>=minSwScore){lastConfirmed=Tools.max(lastConfirmed, stop);}
}
}
// System.out.println("Set lastSuspect="+stop+" on score "+score);
if(USE_LOCALITY){lastSuspect=Tools.max(lastSuspect, stop);}
}
}
if(TRY_PLUS){
int[] rvec=msa.fillAndScoreLimited(query1, array, i, j, minSwScoreSuspect);
if(rvec!=null && rvec[0]>=minSwScoreSuspect){
int score=rvec[0];
int start=rvec[1];
int stop=rvec[2];
if((i==0 || start>i) && (j==array.length-1 || stop<j)){
boolean kill=(score>=minSwScore ||
(score>=suspectMidpoint && lastSuspect>0 && start>=lastSuspect && start-lastSuspect<suspectDistance) ||
(lastConfirmed>0 && start>=lastConfirmed && start-lastConfirmed<suspectDistance));
if(!kill && USE_LOCALITY && array.length-stop>window){//Look ahead
rvec=msa.fillAndScoreLimited(query1, array, stop, stop+window, minSwScoreSuspect);
if(rvec!=null){
if(score>=suspectMidpoint && rvec[0]>=minSwScoreSuspect && rvec[1]-stop<suspectDistance){kill=true;}
else if(score>=minSwScoreSuspect && rvec[0]>=minSwScore && rvec[1]-stop<suspectDistance){kill=true;}
}
}
if(!kill && USE_ALT_MSA){//Try alternate msa
rvec=msa2.fillAndScoreLimited(query1, array, Tools.max(0, start-4), Tools.min(stop+4, array.length-1), minSwScoreSuspect);
if(rvec!=null && rvec[0]>=(minSwScore)){kill=true;}
}
if(kill){
// System.out.println("+:"+score+", "+minSwScore+", "+minSwScoreSuspect+"\t"+lastSuspect+", "+start+", "+stop);
plusFound++;
for(int x=Tools.max(0, start); x<=stop; x++){array[x]='X';}
if(USE_LOCALITY && score>=minSwScore){lastConfirmed=Tools.max(lastConfirmed, stop);}
}
}
// System.out.println("Set lastSuspect="+stop+" on score "+score);
if(USE_LOCALITY){lastSuspect=Tools.max(lastSuspect, stop);}
}
}
}
int found=plusFound+minusFound;
// if(r.synthetic()){
// if(/*r.hasadapter() && */(r.numericID&3)==0){
// if(plusFound>0){truepositive++;}else{falsenegative++;}
// if(plusFound>1){falsepositive+=(plusFound-1);}
// falsepositive+=minusFound;
// expected++;
// }else if(/*r.hasadapter() && */(r.numericID&3)==1){
// if(minusFound>0){truepositive++;}else{falsenegative++;}
// if(minusFound>1){falsepositive+=(minusFound-1);}
// falsepositive+=plusFound;
// expected++;
// }else{
// falsepositive=falsepositive+plusFound+minusFound;
// if(plusFound+minusFound==0){truenegative++;}
// unexpected++;
// }
// }
if(r.synthetic()){
if(/*r.hasadapter() && */(r.numericID&3)==0){
if(found>0){truepositive++;}else{falsenegative++;}
if(found>1){falsepositive+=(found-1);}
expected++;
}else if(/*r.hasadapter() && */(r.numericID&3)==1){
if(found>0){truepositive++;}else{falsenegative++;}
if(found>1){falsepositive+=(found-1);}
expected++;
}else{
falsepositive+=found;
if(found==0){truenegative++;}
unexpected++;
}
}
plusAdaptersFound+=plusFound;
minusAdaptersFound+=minusFound;
if(found>0){
for(int i=npad, j=0; j<r.length(); i++, j++){r.bases[j]=array[i];}
if(DONT_OUTPUT_BROKEN_READS){r.setDiscarded(true);}
badReadsFound++;
}else{
goodReadsFound++;
}
r.setHasAdapter(found>0);
return found;
}
private byte[] npad(final byte[] array, final int pad){
final int len=array.length+2*pad;
if(padbuffer==null || padbuffer.length!=len){padbuffer=new byte[len];}
byte[] r=padbuffer;
for(int i=0; i<pad; i++){r[i]='N';}
for(int i=pad, j=0; j<array.length; i++, j++){r[i]=array[j];}
for(int i=array.length+pad, limit=Tools.min(r.length, len+50); i<limit; i++){r[i]='N';}
padbuffer=null; //Kills the buffer. Causes more memory allocation, but better cache/NUMA locality if threads move around.
return r;
}
private byte[] padbuffer=null;
private final byte[] query1, query2;
private final ConcurrentReadInputStream cris;
private final ConcurrentReadOutputStream ros;
private final float minRatio;
private final MultiStateAligner9PacBioAdapter msa;
private final MultiStateAligner9PacBioAdapter2 msa2;
private final int ALIGN_ROWS;
private final int ALIGN_COLUMNS;
private final int stride;
private final int window;
private final boolean SPLIT;
long plusAdaptersFound=0;
long minusAdaptersFound=0;
long goodReadsFound=0;
long badReadsFound=0;
long truepositive=0;
long truenegative=0;
long falsepositive=0;
long falsenegative=0;
long expected=0;
long unexpected=0;
long basesIn=0;
long basesOut=0;
long readsOut=0;
private final int maxSwScore;
private final int minSwScore;
private final int minSwScoreSuspect;
private final int suspectMidpoint;
private final int maxImperfectSwScore;
long syntheticReads=0;
}
private static int removeDiscarded(ArrayList<Read> list){
int removed=0;
for(int i=0; i<list.size(); i++){
Read r=list.get(i);
if(r.discarded()){
if(r.mate==null || r.mate.discarded()){
list.set(i, null);
removed++;
}
}
}
return removed;
}
public static boolean DONT_OUTPUT_BROKEN_READS;
/** Permission to overwrite existing files */
private static boolean overwrite=false;
/** Permission to append to existing files */
private static boolean append=false;
private static int THREADS=Shared.LOGICAL_PROCESSORS;
private static boolean OUTPUT_READS=false;
private static boolean ordered=false;
private static boolean PERFECTMODE=false;
private static float MINIMUM_ALIGNMENT_SCORE_RATIO=0.31f; //0.31f: At 250bp reads, approx 0.01% false-positive and 94% true-positive.
private static float SUSPECT_RATIO=0.85F;
public static boolean USE_LOCALITY=true;
public static boolean USE_ALT_MSA=true;
public static boolean TRY_PLUS=true;
public static boolean TRY_MINUS=true;
private static int npad=35;
public static int minContig=50;
public static int suspectDistance=100;
public static final String pacbioAdapter="ATCTCTCTCTTTTCCTCCTCCTCCGTTGTTGTTGTTGAGAGAGAT";
public static final String pacbioStandard_v1="TCCTCCTCCTCCGTTGTTGTTGTTGAGAGAGAGAAGGCTGGGCAGGCTATGCACCCTGGTCCAGGTCAAA" +
"AGCTGCGGAACCCGCTAGCGGCCATCTTGGCCACTAGGGGTCCCGCAGATTCATATTGTCGTCTAGCATGCACAATGCTGCAAACCCAGCTTGCAATGCCCACAGCA" +
"AGCGGCCAATCTTTACGCCACGTTGAATTGTTTATTACCTGTGACTGGCTATGGCTTGCAACGCCACTCGTAAAACTAGTACTTTGCGGTTAGGGGAAGTAGACAAA" +
"CCCATTACTCCACTTCCCGGAAGTTCAACTCATTCCAACACGAAATAAAAGTAAACTCAACACCCCAAGCAGGCTATGTGGGGGGGTGATAGGGGTGGATTCTATTT" +
"CCTATCCCATCCCCTAGGATCTCAATTAAGTTACTAGCGAGTTAAATGTCTGTAGCGATCCCGTCAGTCCTATCGCGCGCATCAAGACCTGGTTGGTTGAGCGTGCA" +
"GTAGATCATCGATAAGCTGCGAGTTAGGTCATCCCAGACCGCATCTGGCGCCTAAACGTTCAGTGGTAGCTAAGGCGTCACCTTCGACTGTCTAAAGGCAATATGTC" +
"GTCCTTAGCTCCAAGTCCCTAGCAAGCGTGTCGGGTCTCTCTCTTTTCCTCCTCCTCCGTTGTTGTTGTTGAGAGAGACCCGACACGCTTGCTAGGGACTTGGAGCT" +
"AAGGACGACATATTGCCTTTAGACAGTCGAAGGTGACGCCTTAGCTACCACTGAACGTTTAGGCGCCAGATGCGGTCTGGGATGACCTAACTCGCAGCTTATCGATG" +
"ATCTACTGCACGCTCAACCAACCAGGTCTTGATGCGCGCGATAGGACTGACGGGATCGCTACAGACATTTAACTCGCTAGTAACTTAATTGAGATCCTAGGGGATGG" +
"GATAGGAAATAGAATCCACCCCTATCACCCCCCCACATAGCCTGCTTGGGGTGTTGAGTTTACTTTTATTTCGTGTTGGAATGAGTTGAACTTCCGGGAAGTGGAGT" +
"AATGGGTTTGTCTACTTCCCCTAACCGCAAAGTACTAGTTTTACGAGTGGCGTTGCAAGCCATAGCCAGTCACAGGTAATAAACAATTCAACGTGGCGTAAAGATTG" +
"GCCGCTTGCTGTGGGCATTGCAAGCTGGGTTTGCAGCATTGTGCATGCTAGACGACAATATGAATCTGCGGGACCCCTAGTGGCCAAGATGGCCGCTAGCGGGTTCC" +
"GCAGCTTTTGACCTGGACCAGGGTGCATAGCCTGCCCAGCCTTCTCTCTCTCTTT";
}
| 23,138
|
Java
|
.java
| 566
| 34.934629
| 150
| 0.674419
|
abiswas-odu/Disco
| 24
| 1
| 10
|
GPL-3.0
|
9/4/2024, 7:51:46 PM (Europe/Amsterdam)
| false
| true
| true
| true
| false
| true
| true
| true
| 23,138
|
1,314,901
|
Foo.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test25/in/Foo.java
|
package p0;
class Foo {
// Test adjustment of target method and target type
// because of the intermediary
protected void foo() { // <- create indirection in p1.Bar
}
}
| 181
|
Java
|
.java
| 7
| 23.142857
| 58
| 0.730539
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 181
|
428,758
|
Dialog.java
|
pedroSG94_vlc-example-streamplayer/libvlc/src/main/java/org/videolan/libvlc/Dialog.java
|
/*****************************************************************************
* Dialog.java
*****************************************************************************
* Copyright © 2016 VLC authors, VideoLAN and VideoLabs
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
package org.videolan.libvlc;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.MainThread;
@SuppressWarnings("unused, JniMissingFunction")
public abstract class Dialog {
/**
* Dialog Callback, see {@link Dialog#setCallbacks(LibVLC, Callbacks)}
*/
public interface Callbacks {
/**
* Call when an error message need to be displayed
*
* @param dialog error dialog to be displayed
*/
@MainThread
void onDisplay(ErrorMessage dialog);
/**
* Called when a login dialog need to be displayed
*
* Call {@link LoginDialog#postLogin(String, String, boolean)} to post the answer, or
* call {@link LoginDialog#dismiss()} to dismiss the dialog.
*
* @param dialog login dialog to be displayed
*/
@MainThread
void onDisplay(LoginDialog dialog);
/**
* Called when a question dialog need to be displayed
*
* Call {@link QuestionDialog#postAction(int)} to post the answer, or
* call {@link QuestionDialog#dismiss()} to dismiss the dialog.
*
* @param dialog question dialog to be displayed
*/
@MainThread
void onDisplay(QuestionDialog dialog);
/**
* Called when a progress dialog need to be displayed
*
* Call {@link ProgressDialog#dismiss()} to dismiss the dialog (if it's cancelable).
*
* @param dialog question dialog to be displayed
*/
@MainThread
void onDisplay(ProgressDialog dialog);
/**
* Called when a previously displayed dialog need to be canceled
*
* @param dialog dialog to be canceled
*/
@MainThread
void onCanceled(Dialog dialog);
/**
* Called when a progress dialog needs to be updated
*
* Dialog text and position may be updated, call {@link ProgressDialog#getText()} and
* {@link ProgressDialog#getPosition()} to get the updated information.
*
* @param dialog dialog to be updated
*/
@MainThread
void onProgressUpdate(ProgressDialog dialog);
}
public static final int TYPE_ERROR = 0;
public static final int TYPE_LOGIN = 1;
public static final int TYPE_QUESTION = 2;
public static final int TYPE_PROGRESS = 3;
protected final int mType;
private final String mTitle;
protected String mText;
private Object mContext;
private static Handler sHandler = null;
private static Callbacks sCallbacks = null;
protected Dialog(int type, String title, String text) {
mType = type;
mTitle = title;
mText = text;
}
/**
* Get the type of the dialog
*
* See {@link Dialog#TYPE_ERROR}, {@link Dialog#TYPE_LOGIN}, {@link Dialog#TYPE_QUESTION} and
* {@link Dialog#TYPE_PROGRESS}
* @return
*/
@MainThread
public int getType() {
return mType;
}
/**
* Get the title of the dialog
*/
@MainThread
public String getTitle() {
return mTitle;
}
/**
* Get the text of the dialog
*/
@MainThread
public String getText() {
return mText;
}
/**
* Associate an object with the dialog
*/
@MainThread
public void setContext(Object context) {
mContext = context;
}
/**
* Return the object associated with the dialog
*/
@MainThread
public Object getContext() {
return mContext;
}
/**
* Dismiss the dialog
*/
@MainThread
public void dismiss() {
}
/**
* Register callbacks in order to handle VLC dialogs
*
* @param libVLC valid LibVLC object
* @param callbacks dialog callbacks or null to unregister
*/
@MainThread
public static void setCallbacks(LibVLC libVLC, Callbacks callbacks) {
if (callbacks != null && sHandler == null)
sHandler = new Handler(Looper.getMainLooper());
sCallbacks = callbacks;
nativeSetCallbacks(libVLC, callbacks != null);
}
/**
* Error message
*
* Used to signal an error message to the user
*/
public static class ErrorMessage extends Dialog {
private ErrorMessage(String title, String text) {
super(TYPE_ERROR, title, text);
}
}
protected static abstract class IdDialog extends Dialog {
protected long mId;
protected IdDialog(long id, int type, String title, String text) {
super(type, title, text);
mId = id;
}
@MainThread
public void dismiss() {
if (mId != 0) {
nativeDismiss(mId);
mId = 0;
}
}
private native void nativeDismiss(long id);
}
/**
* Login Dialog
*
* Used to ask credentials to the user
*/
public static class LoginDialog extends IdDialog {
private final String mDefaultUsername;
private final boolean mAskStore;
private LoginDialog(long id, String title, String text, String defaultUsername, boolean askStore) {
super(id, TYPE_LOGIN, title, text);
mDefaultUsername = defaultUsername;
mAskStore = askStore;
}
/**
* Get the default user name that should be pre-filled
*/
@MainThread
public String getDefaultUsername() {
return mDefaultUsername;
}
/**
* Should the dialog ask to the user to store the credentials ?
*
* @return if true, add a checkbox that ask to the user if he wants to store the credentials
*/
@MainThread
public boolean asksStore() {
return mAskStore;
}
/**
* Post an answer
*
* @param username valid username (can't be empty)
* @param password valid password (can be empty)
* @param store if true, store the credentials
*/
@MainThread
public void postLogin(String username, String password, boolean store) {
if (mId != 0) {
nativePostLogin(mId, username, password, store);
mId = 0;
}
}
private native void nativePostLogin(long id, String username, String password, boolean store);
}
/**
* Question dialog
*
* Used to ask a blocking question
*/
public static class QuestionDialog extends IdDialog {
public static final int TYPE_NORMAL = 0;
public static final int TYPE_WARNING = 1;
public static final int TYPE_ERROR = 2;
private final int mQuestionType;
private final String mCancelText;
private final String mAction1Text;
private final String mAction2Text;
private QuestionDialog(long id, String title, String text, int type, String cancelText,
String action1Text, String action2Text) {
super(id, TYPE_QUESTION, title, text);
mQuestionType = type;
mCancelText = cancelText;
mAction1Text = action1Text;
mAction2Text = action2Text;
}
/**
* Get the type (or severity) of the question dialog
*
* See {@link QuestionDialog#TYPE_NORMAL}, {@link QuestionDialog#TYPE_WARNING} and
* {@link QuestionDialog#TYPE_ERROR}
*/
@MainThread
public int getQuestionType() {
return mQuestionType;
}
/**
* Get the text of the cancel button
*/
@MainThread
public String getCancelText() {
return mCancelText;
}
/**
* Get the text of the first button (optional, can be null)
*/
@MainThread
public String getAction1Text() {
return mAction1Text;
}
/**
* Get the text of the second button (optional, can be null)
*/
@MainThread
public String getAction2Text() {
return mAction2Text;
}
/**
* Post an answer
*
* @param action 1 for first action, 2 for second action
*/
@MainThread
public void postAction(int action) {
if (mId != 0) {
nativePostAction(mId, action);
mId = 0;
}
}
private native void nativePostAction(long id, int action);
}
/**
* Progress Dialog
*
* Used to display a progress dialog
*/
public static class ProgressDialog extends IdDialog {
private final boolean mIndeterminate;
private float mPosition;
private final String mCancelText;
private ProgressDialog(long id, String title, String text, boolean indeterminate,
float position, String cancelText) {
super(id, TYPE_PROGRESS, title, text);
mIndeterminate = indeterminate;
mPosition = position;
mCancelText = cancelText;
}
/**
* Return true if the progress dialog is inderterminate
*/
@MainThread
public boolean isIndeterminate() {
return mIndeterminate;
}
/**
* Return true if the progress dialog is cancelable
*/
@MainThread
public boolean isCancelable() {
return mCancelText != null;
}
/**
* Get the position of the progress dialog
* @return position between 0.0 and 1.0
*/
@MainThread
public float getPosition() {
return mPosition;
}
/**
* Get the text of the cancel button
*/
@MainThread
public String getCancelText() {
return mCancelText;
}
private void update(float position, String text) {
mPosition = position;
mText = text;
}
}
@SuppressWarnings("unused") /* Used from JNI */
private static void displayErrorFromNative(String title, String text) {
final ErrorMessage dialog = new ErrorMessage(title, text);
sHandler.post(new Runnable() {
@Override
public void run() {
if (sCallbacks != null)
sCallbacks.onDisplay(dialog);
}
});
}
@SuppressWarnings("unused") /* Used from JNI */
private static Dialog displayLoginFromNative(long id, String title, String text,
String defaultUsername, boolean askStore) {
final LoginDialog dialog = new LoginDialog(id, title, text, defaultUsername, askStore);
sHandler.post(new Runnable() {
@Override
public void run() {
if (sCallbacks != null)
sCallbacks.onDisplay(dialog);
}
});
return dialog;
}
@SuppressWarnings("unused") /* Used from JNI */
private static Dialog displayQuestionFromNative(long id, String title, String text,
int type, String cancelText,
String action1Text, String action2Text) {
final QuestionDialog dialog = new QuestionDialog(id, title, text, type, cancelText,
action1Text, action2Text);
sHandler.post(new Runnable() {
@Override
public void run() {
if (sCallbacks != null)
sCallbacks.onDisplay(dialog);
}
});
return dialog;
}
@SuppressWarnings("unused") /* Used from JNI */
private static Dialog displayProgressFromNative(long id, String title, String text,
boolean indeterminate,
float position, String cancelText) {
final ProgressDialog dialog = new ProgressDialog(id, title, text, indeterminate, position, cancelText);
sHandler.post(new Runnable() {
@Override
public void run() {
if (sCallbacks != null)
sCallbacks.onDisplay(dialog);
}
});
return dialog;
}
@SuppressWarnings("unused") /* Used from JNI */
private static void cancelFromNative(final Dialog dialog) {
sHandler.post(new Runnable() {
@Override
public void run() {
if (dialog instanceof IdDialog)
((IdDialog) dialog).dismiss();
if (sCallbacks != null && dialog != null)
sCallbacks.onCanceled(dialog);
}
});
}
@SuppressWarnings("unused") /* Used from JNI */
private static void updateProgressFromNative(final Dialog dialog, final float position,
final String text) {
sHandler.post(new Runnable() {
@Override
public void run() {
if (dialog.getType() != TYPE_PROGRESS)
throw new IllegalArgumentException("dialog is not a progress dialog");
final ProgressDialog progressDialog = (ProgressDialog) dialog;
progressDialog.update(position, text);
if (sCallbacks != null)
sCallbacks.onProgressUpdate(progressDialog);
}
});
}
private static native void nativeSetCallbacks(LibVLC libVLC, boolean enabled);
}
| 14,803
|
Java
|
.java
| 424
| 25.304245
| 111
| 0.574939
|
pedroSG94/vlc-example-streamplayer
| 227
| 93
| 45
|
GPL-3.0
|
9/4/2024, 7:07:11 PM (Europe/Amsterdam)
| true
| true
| true
| true
| true
| true
| true
| true
| 14,803
|
1,315,898
|
Klus.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/InlineConstant/canInline/test4/in/Klus.java
|
// 5, 36 -> 5, 36 replaceAll == true, removeDeclaration == false
package p;
class Klus {
private static final int KLUSPLATZ= 34;
private int kreuzplatz= (kreuzplatz= -1 +KLUSPLATZ+ (-1));
}
| 195
|
Java
|
.java
| 6
| 30.833333
| 65
| 0.705882
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 195
|
1,317,304
|
B.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/RenameType/test64/out/B.java
|
package p;
/**
* See also p.B {@link p.B} and B
* @see p.B
*/
public class B {
String a= "B";
String pA= "p.B";
}
| 120
|
Java
|
.java
| 9
| 11.666667
| 33
| 0.563636
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 120
|
4,799,672
|
ServletUtilities.java
|
greearb_jfreechart-fse-ct/src/main/java/org/jfree/chart/servlet/ServletUtilities.java
|
/* ===========================================================
* JFreeChart : a free chart library for the Java(tm) platform
* ===========================================================
*
* (C) Copyright 2000-2012, by Object Refinery Limited and Contributors.
*
* Project Info: http://www.jfree.org/jfreechart/index.html
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.]
*
* ---------------------
* ServletUtilities.java
* ---------------------
* (C) Copyright 2002-2008, by Richard Atkinson and Contributors.
*
* Original Author: Richard Atkinson;
* Contributor(s): J?rgen Hoffman;
* David Gilbert (for Object Refinery Limited);
* Douglas Clayton;
*
* Changes
* -------
* 19-Aug-2002 : Version 1;
* 20-Apr-2003 : Added additional sendTempFile method to allow MIME type
* specification and modified original sendTempFile method to
* automatically set MIME type for JPEG and PNG files
* 23-Jun-2003 : Added additional sendTempFile method at the request of
* J?rgen Hoffman;
* 07-Jul-2003 : Added more header information to streamed images;
* 19-Aug-2003 : Forced images to be stored in the temporary directory defined
* by System property java.io.tmpdir, rather than default (RA);
* 24-Mar-2004 : Added temp filename prefix attribute (DG);
* 09-Mar-2005 : Added "one time" file option (DG);
* ------------- JFREECHART 1.0.x RELEASED ------------------------------------
* 10-Jan-2006 : Updated API docs and reformatted (DG);
* 13-Sep-2006 : Format date in response header in English, not locale default
* (see bug 1557141) (DG);
*
*/
package org.jfree.chart.servlet;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.jfree.chart.ChartRenderingInfo;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
/**
* Utility class used for servlet related JFreeChart operations.
*/
public class ServletUtilities {
/** The filename prefix. */
private static String tempFilePrefix = "jfreechart-";
/** A prefix for "one time" charts. */
private static String tempOneTimeFilePrefix = "jfreechart-onetime-";
/**
* Returns the prefix for the temporary file names generated by this class.
*
* @return The prefix (never <code>null</code>).
*/
public static String getTempFilePrefix() {
return ServletUtilities.tempFilePrefix;
}
/**
* Sets the prefix for the temporary file names generated by this class.
*
* @param prefix the prefix (<code>null</code> not permitted).
*/
public static void setTempFilePrefix(String prefix) {
if (prefix == null) {
throw new IllegalArgumentException("Null 'prefix' argument.");
}
ServletUtilities.tempFilePrefix = prefix;
}
/**
* Returns the prefix for "one time" temporary file names generated by
* this class.
*
* @return The prefix.
*/
public static String getTempOneTimeFilePrefix() {
return ServletUtilities.tempOneTimeFilePrefix;
}
/**
* Sets the prefix for the "one time" temporary file names generated by
* this class.
*
* @param prefix the prefix (<code>null</code> not permitted).
*/
public static void setTempOneTimeFilePrefix(String prefix) {
if (prefix == null) {
throw new IllegalArgumentException("Null 'prefix' argument.");
}
ServletUtilities.tempOneTimeFilePrefix = prefix;
}
/**
* Saves the chart as a PNG format file in the temporary directory.
*
* @param chart the JFreeChart to be saved.
* @param width the width of the chart.
* @param height the height of the chart.
* @param session the HttpSession of the client (if <code>null</code>, the
* temporary file is marked as "one-time" and deleted by
* the {@link DisplayChart} servlet right after it is
* streamed to the client).
*
* @return The filename of the chart saved in the temporary directory.
*
* @throws IOException if there is a problem saving the file.
*/
public static String saveChartAsPNG(JFreeChart chart, int width, int height,
HttpSession session) throws IOException {
return ServletUtilities.saveChartAsPNG(chart, width, height, null,
session);
}
/**
* Saves the chart as a PNG format file in the temporary directory and
* populates the {@link ChartRenderingInfo} object which can be used to
* generate an HTML image map.
*
* @param chart the chart to be saved (<code>null</code> not permitted).
* @param width the width of the chart.
* @param height the height of the chart.
* @param info the ChartRenderingInfo object to be populated
* (<code>null</code> permitted).
* @param session the HttpSession of the client (if <code>null</code>, the
* temporary file is marked as "one-time" and deleted by
* the {@link DisplayChart} servlet right after it is
* streamed to the client).
*
* @return The filename of the chart saved in the temporary directory.
*
* @throws IOException if there is a problem saving the file.
*/
public static String saveChartAsPNG(JFreeChart chart, int width, int height,
ChartRenderingInfo info, HttpSession session) throws IOException {
if (chart == null) {
throw new IllegalArgumentException("Null 'chart' argument.");
}
ServletUtilities.createTempDir();
String prefix = ServletUtilities.tempFilePrefix;
if (session == null) {
prefix = ServletUtilities.tempOneTimeFilePrefix;
}
File tempFile = File.createTempFile(prefix, ".png",
new File(System.getProperty("java.io.tmpdir")));
ChartUtilities.saveChartAsPNG(tempFile, chart, width, height, info);
if (session != null) {
ServletUtilities.registerChartForDeletion(tempFile, session);
}
return tempFile.getName();
}
/**
* Saves the chart as a JPEG format file in the temporary directory.
* <p>
* SPECIAL NOTE: Please avoid using JPEG as an image format for charts,
* it is a "lossy" format that introduces visible distortions in the
* resulting image - use PNG instead. In addition, note that JPEG output
* is supported by JFreeChart only for JRE 1.4.2 or later.
*
* @param chart the JFreeChart to be saved.
* @param width the width of the chart.
* @param height the height of the chart.
* @param session the HttpSession of the client (if <code>null</code>, the
* temporary file is marked as "one-time" and deleted by
* the {@link DisplayChart} servlet right after it is
* streamed to the client).
*
* @return The filename of the chart saved in the temporary directory.
*
* @throws IOException if there is a problem saving the file.
*/
public static String saveChartAsJPEG(JFreeChart chart, int width,
int height, HttpSession session)
throws IOException {
return ServletUtilities.saveChartAsJPEG(chart, width, height, null,
session);
}
/**
* Saves the chart as a JPEG format file in the temporary directory and
* populates the <code>ChartRenderingInfo</code> object which can be used
* to generate an HTML image map.
* <p>
* SPECIAL NOTE: Please avoid using JPEG as an image format for charts,
* it is a "lossy" format that introduces visible distortions in the
* resulting image - use PNG instead. In addition, note that JPEG output
* is supported by JFreeChart only for JRE 1.4.2 or later.
*
* @param chart the chart to be saved (<code>null</code> not permitted).
* @param width the width of the chart
* @param height the height of the chart
* @param info the ChartRenderingInfo object to be populated
* @param session the HttpSession of the client (if <code>null</code>, the
* temporary file is marked as "one-time" and deleted by
* the {@link DisplayChart} servlet right after it is
* streamed to the client).
*
* @return The filename of the chart saved in the temporary directory
*
* @throws IOException if there is a problem saving the file.
*/
public static String saveChartAsJPEG(JFreeChart chart, int width,
int height, ChartRenderingInfo info, HttpSession session)
throws IOException {
if (chart == null) {
throw new IllegalArgumentException("Null 'chart' argument.");
}
ServletUtilities.createTempDir();
String prefix = ServletUtilities.tempFilePrefix;
if (session == null) {
prefix = ServletUtilities.tempOneTimeFilePrefix;
}
File tempFile = File.createTempFile(prefix, ".jpeg",
new File(System.getProperty("java.io.tmpdir")));
ChartUtilities.saveChartAsJPEG(tempFile, chart, width, height, info);
if (session != null) {
ServletUtilities.registerChartForDeletion(tempFile, session);
}
return tempFile.getName();
}
/**
* Creates the temporary directory if it does not exist. Throws a
* <code>RuntimeException</code> if the temporary directory is
* <code>null</code>. Uses the system property <code>java.io.tmpdir</code>
* as the temporary directory. This sounds like a strange thing to do but
* my temporary directory was not created on my default Tomcat 4.0.3
* installation. Could save some questions on the forum if it is created
* when not present.
*/
protected static void createTempDir() {
String tempDirName = System.getProperty("java.io.tmpdir");
if (tempDirName == null) {
throw new RuntimeException("Temporary directory system property "
+ "(java.io.tmpdir) is null.");
}
// create the temporary directory if it doesn't exist
File tempDir = new File(tempDirName);
if (!tempDir.exists()) {
tempDir.mkdirs();
}
}
/**
* Adds a {@link ChartDeleter} object to the session object with the name
* <code>JFreeChart_Deleter</code> if there is not already one bound to the
* session and adds the filename to the list of charts to be deleted.
*
* @param tempFile the file to be deleted.
* @param session the HTTP session of the client.
*/
protected static void registerChartForDeletion(File tempFile,
HttpSession session) {
// Add chart to deletion list in session
if (session != null) {
ChartDeleter chartDeleter
= (ChartDeleter) session.getAttribute("JFreeChart_Deleter");
if (chartDeleter == null) {
chartDeleter = new ChartDeleter();
session.setAttribute("JFreeChart_Deleter", chartDeleter);
}
chartDeleter.addChart(tempFile.getName());
}
else {
System.out.println("Session is null - chart will not be deleted");
}
}
/**
* Binary streams the specified file in the temporary directory to the
* HTTP response in 1KB chunks.
*
* @param filename the name of the file in the temporary directory.
* @param response the HTTP response object.
*
* @throws IOException if there is an I/O problem.
*/
public static void sendTempFile(String filename,
HttpServletResponse response) throws IOException {
File file = new File(System.getProperty("java.io.tmpdir"), filename);
ServletUtilities.sendTempFile(file, response);
}
/**
* Binary streams the specified file to the HTTP response in 1KB chunks.
*
* @param file the file to be streamed.
* @param response the HTTP response object.
*
* @throws IOException if there is an I/O problem.
*/
public static void sendTempFile(File file, HttpServletResponse response)
throws IOException {
String mimeType = null;
String filename = file.getName();
if (filename.length() > 5) {
if (filename.substring(filename.length() - 5,
filename.length()).equals(".jpeg")) {
mimeType = "image/jpeg";
}
else if (filename.substring(filename.length() - 4,
filename.length()).equals(".png")) {
mimeType = "image/png";
}
}
ServletUtilities.sendTempFile(file, response, mimeType);
}
/**
* Binary streams the specified file to the HTTP response in 1KB chunks.
*
* @param file the file to be streamed.
* @param response the HTTP response object.
* @param mimeType the mime type of the file, null allowed.
*
* @throws IOException if there is an I/O problem.
*/
public static void sendTempFile(File file, HttpServletResponse response,
String mimeType) throws IOException {
if (file.exists()) {
BufferedInputStream bis = new BufferedInputStream(
new FileInputStream(file));
// Set HTTP headers
if (mimeType != null) {
response.setHeader("Content-Type", mimeType);
}
response.setHeader("Content-Length", String.valueOf(file.length()));
SimpleDateFormat sdf = new SimpleDateFormat(
"EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH);
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
response.setHeader("Last-Modified",
sdf.format(new Date(file.lastModified())));
BufferedOutputStream bos = new BufferedOutputStream(
response.getOutputStream());
byte[] input = new byte[1024];
boolean eof = false;
while (!eof) {
int length = bis.read(input);
if (length == -1) {
eof = true;
}
else {
bos.write(input, 0, length);
}
}
bos.flush();
bis.close();
bos.close();
}
else {
throw new FileNotFoundException(file.getAbsolutePath());
}
}
/**
* Perform a search/replace operation on a String
* There are String methods to do this since (JDK 1.4)
*
* @param inputString the String to have the search/replace operation.
* @param searchString the search String.
* @param replaceString the replace String.
*
* @return The String with the replacements made.
*/
public static String searchReplace(String inputString,
String searchString,
String replaceString) {
int i = inputString.indexOf(searchString);
if (i == -1) {
return inputString;
}
String r = "";
r += inputString.substring(0, i) + replaceString;
if (i + searchString.length() < inputString.length()) {
r += searchReplace(inputString.substring(i + searchString.length()),
searchString, replaceString);
}
return r;
}
}
| 17,354
|
Java
|
.java
| 398
| 34.91206
| 81
| 0.614377
|
greearb/jfreechart-fse-ct
| 1
| 0
| 1
|
LGPL-2.1
|
9/5/2024, 12:32:21 AM (Europe/Amsterdam)
| false
| true
| true
| true
| false
| true
| true
| true
| 17,354
|
4,741,832
|
RowData.java
|
negorath_ntnu-prosjekt1/mysql-connector-java-3.0.17-ga/com/mysql/jdbc/RowData.java
|
/*
Copyright (C) 2002-2004 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
There are special exceptions to the terms and conditions of the GPL
as it is applied to this software. View the full text of the
exception exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
software distribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.mysql.jdbc;
import java.sql.SQLException;
/**
* This interface abstracts away how row data is accessed by
* the result set. It is meant to allow a static implementation
* (Current version), and a streaming one.
*
* @author dgan
*/
public interface RowData {
/**
* What's returned for the size of a result set
* when its size can not be determined.
*/
public static final int RESULT_SET_SIZE_UNKNOWN = -1;
/**
* Returns true if we got the last element.
*
* @return true if after last row
* @throws SQLException if a database error occurs
*/
boolean isAfterLast() throws SQLException;
/**
* Only works on non dynamic result sets.
*
* @param index row number to get at
* @return row data at index
* @throws SQLException if a database error occurs
*/
byte[][] getAt(int index) throws SQLException;
/**
* Returns if iteration has not occured yet.
*
* @return true if before first row
* @throws SQLException if a database error occurs
*/
boolean isBeforeFirst() throws SQLException;
/**
* Moves the current position in the result set to
* the given row number.
*
* @param rowNumber row to move to
* @throws SQLException if a database error occurs
*/
void setCurrentRow(int rowNumber) throws SQLException;
/**
* Returns the current position in the result set as
* a row number.
*
* @return the current row number
* @throws SQLException if a database error occurs
*/
int getCurrentRowNumber() throws SQLException;
/**
* Returns true if the result set is dynamic.
*
* This means that move back and move forward won't work
* because we do not hold on to the records.
*
* @return true if this result set is streaming from the server
* @throws SQLException if a database error occurs
*/
boolean isDynamic() throws SQLException;
/**
* Has no records.
*
* @return true if no records
* @throws SQLException if a database error occurs
*/
boolean isEmpty() throws SQLException;
/**
* Are we on the first row of the result set?
*
* @return true if on first row
* @throws SQLException if a database error occurs
*/
boolean isFirst() throws SQLException;
/**
* Are we on the last row of the result set?
*
* @return true if on last row
* @throws SQLException if a database error occurs
*/
boolean isLast() throws SQLException;
/**
* Adds a row to this row data.
*
* @param row the row to add
* @throws SQLException if a database error occurs
*/
void addRow(byte[][] row) throws SQLException;
/**
* Moves to after last.
*
* @throws SQLException if a database error occurs
*/
void afterLast() throws SQLException;
/**
* Moves to before first.
*
* @throws SQLException if a database error occurs
*/
void beforeFirst() throws SQLException;
/**
* Moves to before last so next el is the last el.
*
* @throws SQLException if a database error occurs
*/
void beforeLast() throws SQLException;
/**
* We're done.
*
* @throws SQLException if a database error occurs
*/
void close() throws SQLException;
/**
* Returns true if another row exsists.
*
* @return true if more rows
* @throws SQLException if a database error occurs
*/
boolean hasNext() throws SQLException;
/**
* Moves the current position relative 'rows' from
* the current position.
*
* @param rows the relative number of rows to move
* @throws SQLException if a database error occurs
*/
void moveRowRelative(int rows) throws SQLException;
/**
* Returns the next row.
*
* @return the next row value
* @throws SQLException if a database error occurs
*/
byte[][] next() throws SQLException;
/**
* Removes the row at the given index.
*
* @param index the row to move to
* @throws SQLException if a database error occurs
*/
void removeRow(int index) throws SQLException;
/**
* Only works on non dynamic result sets.
*
* @return the size of this row data
* @throws SQLException if a database error occurs
*/
int size() throws SQLException;
/**
* Set the result set that 'owns' this RowData
*
* @param rs the result set that 'owns' this RowData
*/
void setOwner(ResultSet rs);
/**
* Returns the result set that 'owns' this RowData
*
* @return the result set that 'owns' this RowData
*/
ResultSet getOwner();
}
| 5,677
|
Java
|
.java
| 181
| 26.226519
| 77
| 0.671552
|
negorath/ntnu-prosjekt1
| 1
| 0
| 0
|
GPL-2.0
|
9/5/2024, 12:29:13 AM (Europe/Amsterdam)
| true
| true
| true
| true
| true
| true
| true
| true
| 5,677
|
5,031,765
|
InMemoryTaskArtifactCache.java
|
cams7_gradle-samples/plugin/core/src/main/groovy/org/gradle/api/internal/changedetection/state/InMemoryTaskArtifactCache.java
|
/*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.api.internal.changedetection.state;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.cache.internal.CacheDecorator;
import org.gradle.cache.internal.FileLock;
import org.gradle.cache.internal.MultiProcessSafePersistentIndexedCache;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class InMemoryTaskArtifactCache implements CacheDecorator {
private final static Logger LOG = Logging.getLogger(InMemoryTaskArtifactCache.class);
private final static Object NULL = new Object();
private static final Map<String, Integer> CACHE_CAPS = new HashMap<String, Integer>();
static {
//it's the simplest implementation, not very nice
//at very least, the max size should be provided at creation, by the creator of the cache
//however, max size is a bit awkward in general and we should look into other options,
//like using the Weighter and relate the cache size to the available heap, etc.
CACHE_CAPS.put("fileSnapshots", 10000);
CACHE_CAPS.put("taskArtifacts", 2000);
CACHE_CAPS.put("outputFileStates", 3000);
CACHE_CAPS.put("fileHashes", 140000);
CACHE_CAPS.put("compilationState", 1000);
//In general, the in-memory cache must be capped at some level, otherwise it is reduces performance in truly gigantic builds
}
private final Object lock = new Object();
private final Cache<String, Cache<Object, Object>> cache = CacheBuilder.newBuilder()
.maximumSize(CACHE_CAPS.size() * 2) //X2 to factor in a child build (for example buildSrc)
.build();
private final Map<String, FileLock.State> states = new HashMap<String, FileLock.State>();
public <K, V> MultiProcessSafePersistentIndexedCache<K, V> decorate(final String cacheId, String cacheName, final MultiProcessSafePersistentIndexedCache<K, V> original) {
final Cache<Object, Object> data = loadData(cacheId, cacheName);
return new MultiProcessSafePersistentIndexedCache<K, V>() {
public void close() {
original.close();
}
public V get(K key) {
assert key instanceof String || key instanceof Long || key instanceof File : "Unsupported key type: " + key;
Object value = data.getIfPresent(key);
if (value == NULL) {
return null;
}
if (value != null) {
return (V) value;
}
V out = original.get(key);
data.put(key, out == null ? NULL : out);
return out;
}
public void put(K key, V value) {
original.put(key, value);
data.put(key, value);
}
public void remove(K key) {
data.put(key, NULL);
original.remove(key);
}
public void onStartWork(String operationDisplayName, FileLock.State currentCacheState) {
boolean outOfDate;
synchronized (lock) {
FileLock.State previousState = states.get(cacheId);
outOfDate = previousState == null || currentCacheState.hasBeenUpdatedSince(previousState);
}
if (outOfDate) {
LOG.info("Invalidating in-memory cache of {}", cacheId);
data.invalidateAll();
}
}
public void onEndWork(FileLock.State currentCacheState) {
synchronized (lock) {
states.put(cacheId, currentCacheState);
}
}
};
}
private Cache<Object, Object> loadData(String cacheId, String cacheName) {
Cache<Object, Object> theData;
synchronized (lock) {
theData = this.cache.getIfPresent(cacheId);
if (theData != null) {
LOG.info("In-memory cache of {}: Size{{}}, {}", cacheId, theData.size() , theData.stats());
} else {
Integer maxSize = CACHE_CAPS.get(cacheName);
assert maxSize != null : "Unknown cache.";
theData = CacheBuilder.newBuilder().maximumSize(maxSize).build();
this.cache.put(cacheId, theData);
}
}
return theData;
}
}
| 5,126
|
Java
|
.java
| 108
| 37.314815
| 174
| 0.6304
|
cams7/gradle-samples
| 1
| 0
| 0
|
GPL-2.0
|
9/5/2024, 12:39:20 AM (Europe/Amsterdam)
| true
| true
| true
| true
| true
| true
| true
| true
| 5,126
|
2,648,309
|
GuiButtonLanguage.java
|
qe7_Osiris/src/main/java/net/minecraft/src/GuiButtonLanguage.java
|
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
public class GuiButtonLanguage extends GuiButton
{
public GuiButtonLanguage(int par1, int par2, int par3)
{
super(par1, par2, par3, 20, 20, "");
}
/**
* Draws this button to the screen.
*/
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
{
if (!drawButton)
{
return;
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, par1Minecraft.renderEngine.getTexture("/gui/gui.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
boolean flag = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + field_52008_a && par3 < yPosition + field_52007_b;
int i = 106;
if (flag)
{
i += field_52007_b;
}
drawTexturedModalRect(xPosition, yPosition, 0, i, field_52008_a, field_52007_b);
}
}
| 942
|
Java
|
.java
| 29
| 25.827586
| 134
| 0.619625
|
qe7/Osiris
| 7
| 2
| 0
|
GPL-3.0
|
9/4/2024, 9:54:57 PM (Europe/Amsterdam)
| false
| false
| false
| true
| false
| true
| false
| true
| 942
|
843,375
|
Replace.java
|
shirleydl_ATest/ATest/src/main/java/com/shirley/aTest/entity/Replace.java
|
package com.shirley.aTest.entity;
import java.util.Map;
/**
* @Description: TODO(替换类)
* @author [email protected]
* @date 2019年8月14日 上午9:08:39
*/
public class Replace {
private int id;
private String name;
private String description;
private Map<String,String> replaceUrl;
private Map<String,Object> replaceData;
private String split;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Map<String,String> getReplaceUrl() {
return replaceUrl;
}
public void setReplaceUrl(Map<String,String> replaceUrl) {
this.replaceUrl = replaceUrl;
}
public Map<String,Object> getReplaceData() {
return replaceData;
}
public void setReplaceData(Map<String,Object> replaceData) {
this.replaceData = replaceData;
}
public String getSplit() {
return split;
}
public void setSplit(String split) {
this.split = split;
}
}
| 1,164
|
Java
|
.java
| 51
| 19.941176
| 61
| 0.753488
|
shirleydl/ATest
| 74
| 38
| 11
|
GPL-3.0
|
9/4/2024, 7:09:22 PM (Europe/Amsterdam)
| false
| false
| false
| true
| false
| false
| false
| true
| 1,148
|
1,319,033
|
A_test729.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/return_in/A_test729.java
|
package return_in;
public class A_test729 {
public void foo(int x) {
while (x==3) {
}
int a = 0;
for (int i = 0; i < 3; i++) {
/*[*/g(i++);/*]*/
}
}
private void g(int i) {}
}
| 194
|
Java
|
.java
| 12
| 13.666667
| 31
| 0.511111
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 194
|
1,941,853
|
Videoio.java
|
GeekAbdelouahed_sign-language/openCVLibrary340/src/main/java/org/opencv/videoio/Videoio.java
|
//
// This file is auto-generated. Please don't modify it!
//
package org.opencv.videoio;
// C++: class Videoio
//javadoc: Videoio
public class Videoio {
public static final int
CV_CAP_ANY = 0,
CV_CAP_MIL = 100,
CV_CAP_VFW = 200,
CV_CAP_V4L = 200,
CV_CAP_V4L2 = 200,
CV_CAP_FIREWARE = 300,
CV_CAP_FIREWIRE = 300,
CV_CAP_IEEE1394 = 300,
CV_CAP_DC1394 = 300,
CV_CAP_CMU1394 = 300,
CV_CAP_STEREO = 400,
CV_CAP_TYZX = 400,
CV_TYZX_LEFT = 400,
CV_TYZX_RIGHT = 401,
CV_TYZX_COLOR = 402,
CV_TYZX_Z = 403,
CV_CAP_QT = 500,
CV_CAP_UNICAP = 600,
CV_CAP_DSHOW = 700,
CV_CAP_MSMF = 1400,
CV_CAP_PVAPI = 800,
CV_CAP_OPENNI = 900,
CV_CAP_OPENNI_ASUS = 910,
CV_CAP_ANDROID = 1000,
CV_CAP_ANDROID_BACK = CV_CAP_ANDROID+99,
CV_CAP_ANDROID_FRONT = CV_CAP_ANDROID+98,
CV_CAP_XIAPI = 1100,
CV_CAP_AVFOUNDATION = 1200,
CV_CAP_GIGANETIX = 1300,
CV_CAP_INTELPERC = 1500,
CV_CAP_OPENNI2 = 1600,
CV_CAP_GPHOTO2 = 1700,
CV_CAP_GSTREAMER = 1800,
CV_CAP_FFMPEG = 1900,
CV_CAP_IMAGES = 2000,
CV_CAP_ARAVIS = 2100,
CV_CAP_PROP_DC1394_OFF = -4,
CV_CAP_PROP_DC1394_MODE_MANUAL = -3,
CV_CAP_PROP_DC1394_MODE_AUTO = -2,
CV_CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,
CV_CAP_PROP_POS_MSEC = 0,
CV_CAP_PROP_POS_FRAMES = 1,
CV_CAP_PROP_POS_AVI_RATIO = 2,
CV_CAP_PROP_FRAME_WIDTH = 3,
CV_CAP_PROP_FRAME_HEIGHT = 4,
CV_CAP_PROP_FPS = 5,
CV_CAP_PROP_FOURCC = 6,
CV_CAP_PROP_FRAME_COUNT = 7,
CV_CAP_PROP_FORMAT = 8,
CV_CAP_PROP_MODE = 9,
CV_CAP_PROP_BRIGHTNESS = 10,
CV_CAP_PROP_CONTRAST = 11,
CV_CAP_PROP_SATURATION = 12,
CV_CAP_PROP_HUE = 13,
CV_CAP_PROP_GAIN = 14,
CV_CAP_PROP_EXPOSURE = 15,
CV_CAP_PROP_CONVERT_RGB = 16,
CV_CAP_PROP_WHITE_BALANCE_BLUE_U = 17,
CV_CAP_PROP_RECTIFICATION = 18,
CV_CAP_PROP_MONOCHROME = 19,
CV_CAP_PROP_SHARPNESS = 20,
CV_CAP_PROP_AUTO_EXPOSURE = 21,
CV_CAP_PROP_GAMMA = 22,
CV_CAP_PROP_TEMPERATURE = 23,
CV_CAP_PROP_TRIGGER = 24,
CV_CAP_PROP_TRIGGER_DELAY = 25,
CV_CAP_PROP_WHITE_BALANCE_RED_V = 26,
CV_CAP_PROP_ZOOM = 27,
CV_CAP_PROP_FOCUS = 28,
CV_CAP_PROP_GUID = 29,
CV_CAP_PROP_ISO_SPEED = 30,
CV_CAP_PROP_MAX_DC1394 = 31,
CV_CAP_PROP_BACKLIGHT = 32,
CV_CAP_PROP_PAN = 33,
CV_CAP_PROP_TILT = 34,
CV_CAP_PROP_ROLL = 35,
CV_CAP_PROP_IRIS = 36,
CV_CAP_PROP_SETTINGS = 37,
CV_CAP_PROP_BUFFERSIZE = 38,
CV_CAP_PROP_AUTOFOCUS = 39,
CV_CAP_PROP_SAR_NUM = 40,
CV_CAP_PROP_SAR_DEN = 41,
CV_CAP_PROP_AUTOGRAB = 1024,
CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING = 1025,
CV_CAP_PROP_PREVIEW_FORMAT = 1026,
CV_CAP_OPENNI_DEPTH_GENERATOR = 1 << 31,
CV_CAP_OPENNI_IMAGE_GENERATOR = 1 << 30,
CV_CAP_OPENNI_IR_GENERATOR = 1 << 29,
CV_CAP_OPENNI_GENERATORS_MASK = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_OPENNI_IR_GENERATOR,
CV_CAP_PROP_OPENNI_OUTPUT_MODE = 100,
CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101,
CV_CAP_PROP_OPENNI_BASELINE = 102,
CV_CAP_PROP_OPENNI_FOCAL_LENGTH = 103,
CV_CAP_PROP_OPENNI_REGISTRATION = 104,
CV_CAP_PROP_OPENNI_REGISTRATION_ON = CV_CAP_PROP_OPENNI_REGISTRATION,
CV_CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105,
CV_CAP_PROP_OPENNI_MAX_BUFFER_SIZE = 106,
CV_CAP_PROP_OPENNI_CIRCLE_BUFFER = 107,
CV_CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
CV_CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,
CV_CAP_PROP_OPENNI2_SYNC = 110,
CV_CAP_PROP_OPENNI2_MIRROR = 111,
CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT,
CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_OUTPUT_MODE,
CV_CAP_OPENNI_DEPTH_GENERATOR_PRESENT = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT,
CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_BASELINE,
CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_FOCAL_LENGTH,
CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_REGISTRATION,
CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION,
CV_CAP_OPENNI_IR_GENERATOR_PRESENT = CV_CAP_OPENNI_IR_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT,
CV_CAP_GSTREAMER_QUEUE_LENGTH = 200,
CV_CAP_PROP_PVAPI_MULTICASTIP = 300,
CV_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301,
CV_CAP_PROP_PVAPI_DECIMATIONHORIZONTAL = 302,
CV_CAP_PROP_PVAPI_DECIMATIONVERTICAL = 303,
CV_CAP_PROP_PVAPI_BINNINGX = 304,
CV_CAP_PROP_PVAPI_BINNINGY = 305,
CV_CAP_PROP_PVAPI_PIXELFORMAT = 306,
CV_CAP_PROP_XI_DOWNSAMPLING = 400,
CV_CAP_PROP_XI_DATA_FORMAT = 401,
CV_CAP_PROP_XI_OFFSET_X = 402,
CV_CAP_PROP_XI_OFFSET_Y = 403,
CV_CAP_PROP_XI_TRG_SOURCE = 404,
CV_CAP_PROP_XI_TRG_SOFTWARE = 405,
CV_CAP_PROP_XI_GPI_SELECTOR = 406,
CV_CAP_PROP_XI_GPI_MODE = 407,
CV_CAP_PROP_XI_GPI_LEVEL = 408,
CV_CAP_PROP_XI_GPO_SELECTOR = 409,
CV_CAP_PROP_XI_GPO_MODE = 410,
CV_CAP_PROP_XI_LED_SELECTOR = 411,
CV_CAP_PROP_XI_LED_MODE = 412,
CV_CAP_PROP_XI_MANUAL_WB = 413,
CV_CAP_PROP_XI_AUTO_WB = 414,
CV_CAP_PROP_XI_AEAG = 415,
CV_CAP_PROP_XI_EXP_PRIORITY = 416,
CV_CAP_PROP_XI_AE_MAX_LIMIT = 417,
CV_CAP_PROP_XI_AG_MAX_LIMIT = 418,
CV_CAP_PROP_XI_AEAG_LEVEL = 419,
CV_CAP_PROP_XI_TIMEOUT = 420,
CV_CAP_PROP_XI_EXPOSURE = 421,
CV_CAP_PROP_XI_EXPOSURE_BURST_COUNT = 422,
CV_CAP_PROP_XI_GAIN_SELECTOR = 423,
CV_CAP_PROP_XI_GAIN = 424,
CV_CAP_PROP_XI_DOWNSAMPLING_TYPE = 426,
CV_CAP_PROP_XI_BINNING_SELECTOR = 427,
CV_CAP_PROP_XI_BINNING_VERTICAL = 428,
CV_CAP_PROP_XI_BINNING_HORIZONTAL = 429,
CV_CAP_PROP_XI_BINNING_PATTERN = 430,
CV_CAP_PROP_XI_DECIMATION_SELECTOR = 431,
CV_CAP_PROP_XI_DECIMATION_VERTICAL = 432,
CV_CAP_PROP_XI_DECIMATION_HORIZONTAL = 433,
CV_CAP_PROP_XI_DECIMATION_PATTERN = 434,
CV_CAP_PROP_XI_TEST_PATTERN_GENERATOR_SELECTOR = 587,
CV_CAP_PROP_XI_TEST_PATTERN = 588,
CV_CAP_PROP_XI_IMAGE_DATA_FORMAT = 435,
CV_CAP_PROP_XI_SHUTTER_TYPE = 436,
CV_CAP_PROP_XI_SENSOR_TAPS = 437,
CV_CAP_PROP_XI_AEAG_ROI_OFFSET_X = 439,
CV_CAP_PROP_XI_AEAG_ROI_OFFSET_Y = 440,
CV_CAP_PROP_XI_AEAG_ROI_WIDTH = 441,
CV_CAP_PROP_XI_AEAG_ROI_HEIGHT = 442,
CV_CAP_PROP_XI_BPC = 445,
CV_CAP_PROP_XI_WB_KR = 448,
CV_CAP_PROP_XI_WB_KG = 449,
CV_CAP_PROP_XI_WB_KB = 450,
CV_CAP_PROP_XI_WIDTH = 451,
CV_CAP_PROP_XI_HEIGHT = 452,
CV_CAP_PROP_XI_REGION_SELECTOR = 589,
CV_CAP_PROP_XI_REGION_MODE = 595,
CV_CAP_PROP_XI_LIMIT_BANDWIDTH = 459,
CV_CAP_PROP_XI_SENSOR_DATA_BIT_DEPTH = 460,
CV_CAP_PROP_XI_OUTPUT_DATA_BIT_DEPTH = 461,
CV_CAP_PROP_XI_IMAGE_DATA_BIT_DEPTH = 462,
CV_CAP_PROP_XI_OUTPUT_DATA_PACKING = 463,
CV_CAP_PROP_XI_OUTPUT_DATA_PACKING_TYPE = 464,
CV_CAP_PROP_XI_IS_COOLED = 465,
CV_CAP_PROP_XI_COOLING = 466,
CV_CAP_PROP_XI_TARGET_TEMP = 467,
CV_CAP_PROP_XI_CHIP_TEMP = 468,
CV_CAP_PROP_XI_HOUS_TEMP = 469,
CV_CAP_PROP_XI_HOUS_BACK_SIDE_TEMP = 590,
CV_CAP_PROP_XI_SENSOR_BOARD_TEMP = 596,
CV_CAP_PROP_XI_CMS = 470,
CV_CAP_PROP_XI_APPLY_CMS = 471,
CV_CAP_PROP_XI_IMAGE_IS_COLOR = 474,
CV_CAP_PROP_XI_COLOR_FILTER_ARRAY = 475,
CV_CAP_PROP_XI_GAMMAY = 476,
CV_CAP_PROP_XI_GAMMAC = 477,
CV_CAP_PROP_XI_SHARPNESS = 478,
CV_CAP_PROP_XI_CC_MATRIX_00 = 479,
CV_CAP_PROP_XI_CC_MATRIX_01 = 480,
CV_CAP_PROP_XI_CC_MATRIX_02 = 481,
CV_CAP_PROP_XI_CC_MATRIX_03 = 482,
CV_CAP_PROP_XI_CC_MATRIX_10 = 483,
CV_CAP_PROP_XI_CC_MATRIX_11 = 484,
CV_CAP_PROP_XI_CC_MATRIX_12 = 485,
CV_CAP_PROP_XI_CC_MATRIX_13 = 486,
CV_CAP_PROP_XI_CC_MATRIX_20 = 487,
CV_CAP_PROP_XI_CC_MATRIX_21 = 488,
CV_CAP_PROP_XI_CC_MATRIX_22 = 489,
CV_CAP_PROP_XI_CC_MATRIX_23 = 490,
CV_CAP_PROP_XI_CC_MATRIX_30 = 491,
CV_CAP_PROP_XI_CC_MATRIX_31 = 492,
CV_CAP_PROP_XI_CC_MATRIX_32 = 493,
CV_CAP_PROP_XI_CC_MATRIX_33 = 494,
CV_CAP_PROP_XI_DEFAULT_CC_MATRIX = 495,
CV_CAP_PROP_XI_TRG_SELECTOR = 498,
CV_CAP_PROP_XI_ACQ_FRAME_BURST_COUNT = 499,
CV_CAP_PROP_XI_DEBOUNCE_EN = 507,
CV_CAP_PROP_XI_DEBOUNCE_T0 = 508,
CV_CAP_PROP_XI_DEBOUNCE_T1 = 509,
CV_CAP_PROP_XI_DEBOUNCE_POL = 510,
CV_CAP_PROP_XI_LENS_MODE = 511,
CV_CAP_PROP_XI_LENS_APERTURE_VALUE = 512,
CV_CAP_PROP_XI_LENS_FOCUS_MOVEMENT_VALUE = 513,
CV_CAP_PROP_XI_LENS_FOCUS_MOVE = 514,
CV_CAP_PROP_XI_LENS_FOCUS_DISTANCE = 515,
CV_CAP_PROP_XI_LENS_FOCAL_LENGTH = 516,
CV_CAP_PROP_XI_LENS_FEATURE_SELECTOR = 517,
CV_CAP_PROP_XI_LENS_FEATURE = 518,
CV_CAP_PROP_XI_DEVICE_MODEL_ID = 521,
CV_CAP_PROP_XI_DEVICE_SN = 522,
CV_CAP_PROP_XI_IMAGE_DATA_FORMAT_RGB32_ALPHA = 529,
CV_CAP_PROP_XI_IMAGE_PAYLOAD_SIZE = 530,
CV_CAP_PROP_XI_TRANSPORT_PIXEL_FORMAT = 531,
CV_CAP_PROP_XI_SENSOR_CLOCK_FREQ_HZ = 532,
CV_CAP_PROP_XI_SENSOR_CLOCK_FREQ_INDEX = 533,
CV_CAP_PROP_XI_SENSOR_OUTPUT_CHANNEL_COUNT = 534,
CV_CAP_PROP_XI_FRAMERATE = 535,
CV_CAP_PROP_XI_COUNTER_SELECTOR = 536,
CV_CAP_PROP_XI_COUNTER_VALUE = 537,
CV_CAP_PROP_XI_ACQ_TIMING_MODE = 538,
CV_CAP_PROP_XI_AVAILABLE_BANDWIDTH = 539,
CV_CAP_PROP_XI_BUFFER_POLICY = 540,
CV_CAP_PROP_XI_LUT_EN = 541,
CV_CAP_PROP_XI_LUT_INDEX = 542,
CV_CAP_PROP_XI_LUT_VALUE = 543,
CV_CAP_PROP_XI_TRG_DELAY = 544,
CV_CAP_PROP_XI_TS_RST_MODE = 545,
CV_CAP_PROP_XI_TS_RST_SOURCE = 546,
CV_CAP_PROP_XI_IS_DEVICE_EXIST = 547,
CV_CAP_PROP_XI_ACQ_BUFFER_SIZE = 548,
CV_CAP_PROP_XI_ACQ_BUFFER_SIZE_UNIT = 549,
CV_CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_SIZE = 550,
CV_CAP_PROP_XI_BUFFERS_QUEUE_SIZE = 551,
CV_CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_COMMIT = 552,
CV_CAP_PROP_XI_RECENT_FRAME = 553,
CV_CAP_PROP_XI_DEVICE_RESET = 554,
CV_CAP_PROP_XI_COLUMN_FPN_CORRECTION = 555,
CV_CAP_PROP_XI_ROW_FPN_CORRECTION = 591,
CV_CAP_PROP_XI_SENSOR_MODE = 558,
CV_CAP_PROP_XI_HDR = 559,
CV_CAP_PROP_XI_HDR_KNEEPOINT_COUNT = 560,
CV_CAP_PROP_XI_HDR_T1 = 561,
CV_CAP_PROP_XI_HDR_T2 = 562,
CV_CAP_PROP_XI_KNEEPOINT1 = 563,
CV_CAP_PROP_XI_KNEEPOINT2 = 564,
CV_CAP_PROP_XI_IMAGE_BLACK_LEVEL = 565,
CV_CAP_PROP_XI_HW_REVISION = 571,
CV_CAP_PROP_XI_DEBUG_LEVEL = 572,
CV_CAP_PROP_XI_AUTO_BANDWIDTH_CALCULATION = 573,
CV_CAP_PROP_XI_FFS_FILE_ID = 594,
CV_CAP_PROP_XI_FFS_FILE_SIZE = 580,
CV_CAP_PROP_XI_FREE_FFS_SIZE = 581,
CV_CAP_PROP_XI_USED_FFS_SIZE = 582,
CV_CAP_PROP_XI_FFS_ACCESS_KEY = 583,
CV_CAP_PROP_XI_SENSOR_FEATURE_SELECTOR = 585,
CV_CAP_PROP_XI_SENSOR_FEATURE_VALUE = 586,
CV_CAP_PROP_ANDROID_FLASH_MODE = 8001,
CV_CAP_PROP_ANDROID_FOCUS_MODE = 8002,
CV_CAP_PROP_ANDROID_WHITE_BALANCE = 8003,
CV_CAP_PROP_ANDROID_ANTIBANDING = 8004,
CV_CAP_PROP_ANDROID_FOCAL_LENGTH = 8005,
CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR = 8006,
CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_OPTIMAL = 8007,
CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR = 8008,
CV_CAP_PROP_ANDROID_EXPOSE_LOCK = 8009,
CV_CAP_PROP_ANDROID_WHITEBALANCE_LOCK = 8010,
CV_CAP_PROP_IOS_DEVICE_FOCUS = 9001,
CV_CAP_PROP_IOS_DEVICE_EXPOSURE = 9002,
CV_CAP_PROP_IOS_DEVICE_FLASH = 9003,
CV_CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
CV_CAP_PROP_IOS_DEVICE_TORCH = 9005,
CV_CAP_PROP_GIGA_FRAME_OFFSET_X = 10001,
CV_CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002,
CV_CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003,
CV_CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004,
CV_CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,
CV_CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006,
CV_CAP_PROP_INTELPERC_PROFILE_COUNT = 11001,
CV_CAP_PROP_INTELPERC_PROFILE_IDX = 11002,
CV_CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE = 11003,
CV_CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE = 11004,
CV_CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD = 11005,
CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ = 11006,
CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT = 11007,
CV_CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29,
CV_CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28,
CV_CAP_INTELPERC_GENERATORS_MASK = CV_CAP_INTELPERC_DEPTH_GENERATOR + CV_CAP_INTELPERC_IMAGE_GENERATOR,
CV_CAP_MODE_BGR = 0,
CV_CAP_MODE_RGB = 1,
CV_CAP_MODE_GRAY = 2,
CV_CAP_MODE_YUYV = 3,
CV_CAP_OPENNI_DEPTH_MAP = 0,
CV_CAP_OPENNI_POINT_CLOUD_MAP = 1,
CV_CAP_OPENNI_DISPARITY_MAP = 2,
CV_CAP_OPENNI_DISPARITY_MAP_32F = 3,
CV_CAP_OPENNI_VALID_DEPTH_MASK = 4,
CV_CAP_OPENNI_BGR_IMAGE = 5,
CV_CAP_OPENNI_GRAY_IMAGE = 6,
CV_CAP_OPENNI_IR_IMAGE = 7,
CV_CAP_OPENNI_VGA_30HZ = 0,
CV_CAP_OPENNI_SXGA_15HZ = 1,
CV_CAP_OPENNI_SXGA_30HZ = 2,
CV_CAP_OPENNI_QVGA_30HZ = 3,
CV_CAP_OPENNI_QVGA_60HZ = 4,
CV_CAP_INTELPERC_DEPTH_MAP = 0,
CV_CAP_INTELPERC_UVDEPTH_MAP = 1,
CV_CAP_INTELPERC_IR_MAP = 2,
CV_CAP_INTELPERC_IMAGE = 3,
CV_CAP_PROP_GPHOTO2_PREVIEW = 17001,
CV_CAP_PROP_GPHOTO2_WIDGET_ENUMERATE = 17002,
CV_CAP_PROP_GPHOTO2_RELOAD_CONFIG = 17003,
CV_CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE = 17004,
CV_CAP_PROP_GPHOTO2_COLLECT_MSGS = 17005,
CV_CAP_PROP_GPHOTO2_FLUSH_MSGS = 17006,
CV_CAP_PROP_SPEED = 17007,
CV_CAP_PROP_APERTURE = 17008,
CV_CAP_PROP_EXPOSUREPROGRAM = 17009,
CV_CAP_PROP_VIEWFINDER = 17010,
CAP_ANY = 0,
CAP_VFW = 200,
CAP_V4L = 200,
CAP_V4L2 = CAP_V4L,
CAP_FIREWIRE = 300,
CAP_FIREWARE = CAP_FIREWIRE,
CAP_IEEE1394 = CAP_FIREWIRE,
CAP_DC1394 = CAP_FIREWIRE,
CAP_CMU1394 = CAP_FIREWIRE,
CAP_QT = 500,
CAP_UNICAP = 600,
CAP_DSHOW = 700,
CAP_PVAPI = 800,
CAP_OPENNI = 900,
CAP_OPENNI_ASUS = 910,
CAP_ANDROID = 1000,
CAP_XIAPI = 1100,
CAP_AVFOUNDATION = 1200,
CAP_GIGANETIX = 1300,
CAP_MSMF = 1400,
CAP_WINRT = 1410,
CAP_INTELPERC = 1500,
CAP_OPENNI2 = 1600,
CAP_OPENNI2_ASUS = 1610,
CAP_GPHOTO2 = 1700,
CAP_GSTREAMER = 1800,
CAP_FFMPEG = 1900,
CAP_IMAGES = 2000,
CAP_ARAVIS = 2100,
CAP_OPENCV_MJPEG = 2200,
CAP_INTEL_MFX = 2300,
CAP_PROP_POS_MSEC = 0,
CAP_PROP_POS_FRAMES = 1,
CAP_PROP_POS_AVI_RATIO = 2,
CAP_PROP_FRAME_WIDTH = 3,
CAP_PROP_FRAME_HEIGHT = 4,
CAP_PROP_FPS = 5,
CAP_PROP_FOURCC = 6,
CAP_PROP_FRAME_COUNT = 7,
CAP_PROP_FORMAT = 8,
CAP_PROP_MODE = 9,
CAP_PROP_BRIGHTNESS = 10,
CAP_PROP_CONTRAST = 11,
CAP_PROP_SATURATION = 12,
CAP_PROP_HUE = 13,
CAP_PROP_GAIN = 14,
CAP_PROP_EXPOSURE = 15,
CAP_PROP_CONVERT_RGB = 16,
CAP_PROP_WHITE_BALANCE_BLUE_U = 17,
CAP_PROP_RECTIFICATION = 18,
CAP_PROP_MONOCHROME = 19,
CAP_PROP_SHARPNESS = 20,
CAP_PROP_AUTO_EXPOSURE = 21,
CAP_PROP_GAMMA = 22,
CAP_PROP_TEMPERATURE = 23,
CAP_PROP_TRIGGER = 24,
CAP_PROP_TRIGGER_DELAY = 25,
CAP_PROP_WHITE_BALANCE_RED_V = 26,
CAP_PROP_ZOOM = 27,
CAP_PROP_FOCUS = 28,
CAP_PROP_GUID = 29,
CAP_PROP_ISO_SPEED = 30,
CAP_PROP_BACKLIGHT = 32,
CAP_PROP_PAN = 33,
CAP_PROP_TILT = 34,
CAP_PROP_ROLL = 35,
CAP_PROP_IRIS = 36,
CAP_PROP_SETTINGS = 37,
CAP_PROP_BUFFERSIZE = 38,
CAP_PROP_AUTOFOCUS = 39,
CAP_MODE_BGR = 0,
CAP_MODE_RGB = 1,
CAP_MODE_GRAY = 2,
CAP_MODE_YUYV = 3,
VIDEOWRITER_PROP_QUALITY = 1,
VIDEOWRITER_PROP_FRAMEBYTES = 2,
VIDEOWRITER_PROP_NSTRIPES = 3,
CAP_PROP_DC1394_OFF = -4,
CAP_PROP_DC1394_MODE_MANUAL = -3,
CAP_PROP_DC1394_MODE_AUTO = -2,
CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,
CAP_PROP_DC1394_MAX = 31,
CAP_OPENNI_DEPTH_GENERATOR = 1 << 31,
CAP_OPENNI_IMAGE_GENERATOR = 1 << 30,
CAP_OPENNI_IR_GENERATOR = 1 << 29,
CAP_OPENNI_GENERATORS_MASK = CAP_OPENNI_DEPTH_GENERATOR + CAP_OPENNI_IMAGE_GENERATOR + CAP_OPENNI_IR_GENERATOR,
CAP_PROP_OPENNI_OUTPUT_MODE = 100,
CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101,
CAP_PROP_OPENNI_BASELINE = 102,
CAP_PROP_OPENNI_FOCAL_LENGTH = 103,
CAP_PROP_OPENNI_REGISTRATION = 104,
CAP_PROP_OPENNI_REGISTRATION_ON = CAP_PROP_OPENNI_REGISTRATION,
CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105,
CAP_PROP_OPENNI_MAX_BUFFER_SIZE = 106,
CAP_PROP_OPENNI_CIRCLE_BUFFER = 107,
CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,
CAP_PROP_OPENNI2_SYNC = 110,
CAP_PROP_OPENNI2_MIRROR = 111,
CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_OUTPUT_MODE,
CAP_OPENNI_DEPTH_GENERATOR_PRESENT = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_BASELINE,
CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_FOCAL_LENGTH,
CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_REGISTRATION,
CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION,
CAP_OPENNI_IR_GENERATOR_PRESENT = CAP_OPENNI_IR_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
CAP_OPENNI_DEPTH_MAP = 0,
CAP_OPENNI_POINT_CLOUD_MAP = 1,
CAP_OPENNI_DISPARITY_MAP = 2,
CAP_OPENNI_DISPARITY_MAP_32F = 3,
CAP_OPENNI_VALID_DEPTH_MASK = 4,
CAP_OPENNI_BGR_IMAGE = 5,
CAP_OPENNI_GRAY_IMAGE = 6,
CAP_OPENNI_IR_IMAGE = 7,
CAP_OPENNI_VGA_30HZ = 0,
CAP_OPENNI_SXGA_15HZ = 1,
CAP_OPENNI_SXGA_30HZ = 2,
CAP_OPENNI_QVGA_30HZ = 3,
CAP_OPENNI_QVGA_60HZ = 4,
CAP_PROP_GSTREAMER_QUEUE_LENGTH = 200,
CAP_PROP_PVAPI_MULTICASTIP = 300,
CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301,
CAP_PROP_PVAPI_DECIMATIONHORIZONTAL = 302,
CAP_PROP_PVAPI_DECIMATIONVERTICAL = 303,
CAP_PROP_PVAPI_BINNINGX = 304,
CAP_PROP_PVAPI_BINNINGY = 305,
CAP_PROP_PVAPI_PIXELFORMAT = 306,
CAP_PVAPI_FSTRIGMODE_FREERUN = 0,
CAP_PVAPI_FSTRIGMODE_SYNCIN1 = 1,
CAP_PVAPI_FSTRIGMODE_SYNCIN2 = 2,
CAP_PVAPI_FSTRIGMODE_FIXEDRATE = 3,
CAP_PVAPI_FSTRIGMODE_SOFTWARE = 4,
CAP_PVAPI_DECIMATION_OFF = 1,
CAP_PVAPI_DECIMATION_2OUTOF4 = 2,
CAP_PVAPI_DECIMATION_2OUTOF8 = 4,
CAP_PVAPI_DECIMATION_2OUTOF16 = 8,
CAP_PVAPI_PIXELFORMAT_MONO8 = 1,
CAP_PVAPI_PIXELFORMAT_MONO16 = 2,
CAP_PVAPI_PIXELFORMAT_BAYER8 = 3,
CAP_PVAPI_PIXELFORMAT_BAYER16 = 4,
CAP_PVAPI_PIXELFORMAT_RGB24 = 5,
CAP_PVAPI_PIXELFORMAT_BGR24 = 6,
CAP_PVAPI_PIXELFORMAT_RGBA32 = 7,
CAP_PVAPI_PIXELFORMAT_BGRA32 = 8,
CAP_PROP_XI_DOWNSAMPLING = 400,
CAP_PROP_XI_DATA_FORMAT = 401,
CAP_PROP_XI_OFFSET_X = 402,
CAP_PROP_XI_OFFSET_Y = 403,
CAP_PROP_XI_TRG_SOURCE = 404,
CAP_PROP_XI_TRG_SOFTWARE = 405,
CAP_PROP_XI_GPI_SELECTOR = 406,
CAP_PROP_XI_GPI_MODE = 407,
CAP_PROP_XI_GPI_LEVEL = 408,
CAP_PROP_XI_GPO_SELECTOR = 409,
CAP_PROP_XI_GPO_MODE = 410,
CAP_PROP_XI_LED_SELECTOR = 411,
CAP_PROP_XI_LED_MODE = 412,
CAP_PROP_XI_MANUAL_WB = 413,
CAP_PROP_XI_AUTO_WB = 414,
CAP_PROP_XI_AEAG = 415,
CAP_PROP_XI_EXP_PRIORITY = 416,
CAP_PROP_XI_AE_MAX_LIMIT = 417,
CAP_PROP_XI_AG_MAX_LIMIT = 418,
CAP_PROP_XI_AEAG_LEVEL = 419,
CAP_PROP_XI_TIMEOUT = 420,
CAP_PROP_XI_EXPOSURE = 421,
CAP_PROP_XI_EXPOSURE_BURST_COUNT = 422,
CAP_PROP_XI_GAIN_SELECTOR = 423,
CAP_PROP_XI_GAIN = 424,
CAP_PROP_XI_DOWNSAMPLING_TYPE = 426,
CAP_PROP_XI_BINNING_SELECTOR = 427,
CAP_PROP_XI_BINNING_VERTICAL = 428,
CAP_PROP_XI_BINNING_HORIZONTAL = 429,
CAP_PROP_XI_BINNING_PATTERN = 430,
CAP_PROP_XI_DECIMATION_SELECTOR = 431,
CAP_PROP_XI_DECIMATION_VERTICAL = 432,
CAP_PROP_XI_DECIMATION_HORIZONTAL = 433,
CAP_PROP_XI_DECIMATION_PATTERN = 434,
CAP_PROP_XI_TEST_PATTERN_GENERATOR_SELECTOR = 587,
CAP_PROP_XI_TEST_PATTERN = 588,
CAP_PROP_XI_IMAGE_DATA_FORMAT = 435,
CAP_PROP_XI_SHUTTER_TYPE = 436,
CAP_PROP_XI_SENSOR_TAPS = 437,
CAP_PROP_XI_AEAG_ROI_OFFSET_X = 439,
CAP_PROP_XI_AEAG_ROI_OFFSET_Y = 440,
CAP_PROP_XI_AEAG_ROI_WIDTH = 441,
CAP_PROP_XI_AEAG_ROI_HEIGHT = 442,
CAP_PROP_XI_BPC = 445,
CAP_PROP_XI_WB_KR = 448,
CAP_PROP_XI_WB_KG = 449,
CAP_PROP_XI_WB_KB = 450,
CAP_PROP_XI_WIDTH = 451,
CAP_PROP_XI_HEIGHT = 452,
CAP_PROP_XI_REGION_SELECTOR = 589,
CAP_PROP_XI_REGION_MODE = 595,
CAP_PROP_XI_LIMIT_BANDWIDTH = 459,
CAP_PROP_XI_SENSOR_DATA_BIT_DEPTH = 460,
CAP_PROP_XI_OUTPUT_DATA_BIT_DEPTH = 461,
CAP_PROP_XI_IMAGE_DATA_BIT_DEPTH = 462,
CAP_PROP_XI_OUTPUT_DATA_PACKING = 463,
CAP_PROP_XI_OUTPUT_DATA_PACKING_TYPE = 464,
CAP_PROP_XI_IS_COOLED = 465,
CAP_PROP_XI_COOLING = 466,
CAP_PROP_XI_TARGET_TEMP = 467,
CAP_PROP_XI_CHIP_TEMP = 468,
CAP_PROP_XI_HOUS_TEMP = 469,
CAP_PROP_XI_HOUS_BACK_SIDE_TEMP = 590,
CAP_PROP_XI_SENSOR_BOARD_TEMP = 596,
CAP_PROP_XI_CMS = 470,
CAP_PROP_XI_APPLY_CMS = 471,
CAP_PROP_XI_IMAGE_IS_COLOR = 474,
CAP_PROP_XI_COLOR_FILTER_ARRAY = 475,
CAP_PROP_XI_GAMMAY = 476,
CAP_PROP_XI_GAMMAC = 477,
CAP_PROP_XI_SHARPNESS = 478,
CAP_PROP_XI_CC_MATRIX_00 = 479,
CAP_PROP_XI_CC_MATRIX_01 = 480,
CAP_PROP_XI_CC_MATRIX_02 = 481,
CAP_PROP_XI_CC_MATRIX_03 = 482,
CAP_PROP_XI_CC_MATRIX_10 = 483,
CAP_PROP_XI_CC_MATRIX_11 = 484,
CAP_PROP_XI_CC_MATRIX_12 = 485,
CAP_PROP_XI_CC_MATRIX_13 = 486,
CAP_PROP_XI_CC_MATRIX_20 = 487,
CAP_PROP_XI_CC_MATRIX_21 = 488,
CAP_PROP_XI_CC_MATRIX_22 = 489,
CAP_PROP_XI_CC_MATRIX_23 = 490,
CAP_PROP_XI_CC_MATRIX_30 = 491,
CAP_PROP_XI_CC_MATRIX_31 = 492,
CAP_PROP_XI_CC_MATRIX_32 = 493,
CAP_PROP_XI_CC_MATRIX_33 = 494,
CAP_PROP_XI_DEFAULT_CC_MATRIX = 495,
CAP_PROP_XI_TRG_SELECTOR = 498,
CAP_PROP_XI_ACQ_FRAME_BURST_COUNT = 499,
CAP_PROP_XI_DEBOUNCE_EN = 507,
CAP_PROP_XI_DEBOUNCE_T0 = 508,
CAP_PROP_XI_DEBOUNCE_T1 = 509,
CAP_PROP_XI_DEBOUNCE_POL = 510,
CAP_PROP_XI_LENS_MODE = 511,
CAP_PROP_XI_LENS_APERTURE_VALUE = 512,
CAP_PROP_XI_LENS_FOCUS_MOVEMENT_VALUE = 513,
CAP_PROP_XI_LENS_FOCUS_MOVE = 514,
CAP_PROP_XI_LENS_FOCUS_DISTANCE = 515,
CAP_PROP_XI_LENS_FOCAL_LENGTH = 516,
CAP_PROP_XI_LENS_FEATURE_SELECTOR = 517,
CAP_PROP_XI_LENS_FEATURE = 518,
CAP_PROP_XI_DEVICE_MODEL_ID = 521,
CAP_PROP_XI_DEVICE_SN = 522,
CAP_PROP_XI_IMAGE_DATA_FORMAT_RGB32_ALPHA = 529,
CAP_PROP_XI_IMAGE_PAYLOAD_SIZE = 530,
CAP_PROP_XI_TRANSPORT_PIXEL_FORMAT = 531,
CAP_PROP_XI_SENSOR_CLOCK_FREQ_HZ = 532,
CAP_PROP_XI_SENSOR_CLOCK_FREQ_INDEX = 533,
CAP_PROP_XI_SENSOR_OUTPUT_CHANNEL_COUNT = 534,
CAP_PROP_XI_FRAMERATE = 535,
CAP_PROP_XI_COUNTER_SELECTOR = 536,
CAP_PROP_XI_COUNTER_VALUE = 537,
CAP_PROP_XI_ACQ_TIMING_MODE = 538,
CAP_PROP_XI_AVAILABLE_BANDWIDTH = 539,
CAP_PROP_XI_BUFFER_POLICY = 540,
CAP_PROP_XI_LUT_EN = 541,
CAP_PROP_XI_LUT_INDEX = 542,
CAP_PROP_XI_LUT_VALUE = 543,
CAP_PROP_XI_TRG_DELAY = 544,
CAP_PROP_XI_TS_RST_MODE = 545,
CAP_PROP_XI_TS_RST_SOURCE = 546,
CAP_PROP_XI_IS_DEVICE_EXIST = 547,
CAP_PROP_XI_ACQ_BUFFER_SIZE = 548,
CAP_PROP_XI_ACQ_BUFFER_SIZE_UNIT = 549,
CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_SIZE = 550,
CAP_PROP_XI_BUFFERS_QUEUE_SIZE = 551,
CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_COMMIT = 552,
CAP_PROP_XI_RECENT_FRAME = 553,
CAP_PROP_XI_DEVICE_RESET = 554,
CAP_PROP_XI_COLUMN_FPN_CORRECTION = 555,
CAP_PROP_XI_ROW_FPN_CORRECTION = 591,
CAP_PROP_XI_SENSOR_MODE = 558,
CAP_PROP_XI_HDR = 559,
CAP_PROP_XI_HDR_KNEEPOINT_COUNT = 560,
CAP_PROP_XI_HDR_T1 = 561,
CAP_PROP_XI_HDR_T2 = 562,
CAP_PROP_XI_KNEEPOINT1 = 563,
CAP_PROP_XI_KNEEPOINT2 = 564,
CAP_PROP_XI_IMAGE_BLACK_LEVEL = 565,
CAP_PROP_XI_HW_REVISION = 571,
CAP_PROP_XI_DEBUG_LEVEL = 572,
CAP_PROP_XI_AUTO_BANDWIDTH_CALCULATION = 573,
CAP_PROP_XI_FFS_FILE_ID = 594,
CAP_PROP_XI_FFS_FILE_SIZE = 580,
CAP_PROP_XI_FREE_FFS_SIZE = 581,
CAP_PROP_XI_USED_FFS_SIZE = 582,
CAP_PROP_XI_FFS_ACCESS_KEY = 583,
CAP_PROP_XI_SENSOR_FEATURE_SELECTOR = 585,
CAP_PROP_XI_SENSOR_FEATURE_VALUE = 586,
CAP_PROP_IOS_DEVICE_FOCUS = 9001,
CAP_PROP_IOS_DEVICE_EXPOSURE = 9002,
CAP_PROP_IOS_DEVICE_FLASH = 9003,
CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
CAP_PROP_IOS_DEVICE_TORCH = 9005,
CAP_PROP_GIGA_FRAME_OFFSET_X = 10001,
CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002,
CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003,
CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004,
CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,
CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006,
CAP_PROP_INTELPERC_PROFILE_COUNT = 11001,
CAP_PROP_INTELPERC_PROFILE_IDX = 11002,
CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE = 11003,
CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE = 11004,
CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD = 11005,
CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ = 11006,
CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT = 11007,
CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29,
CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28,
CAP_INTELPERC_GENERATORS_MASK = CAP_INTELPERC_DEPTH_GENERATOR + CAP_INTELPERC_IMAGE_GENERATOR,
CAP_INTELPERC_DEPTH_MAP = 0,
CAP_INTELPERC_UVDEPTH_MAP = 1,
CAP_INTELPERC_IR_MAP = 2,
CAP_INTELPERC_IMAGE = 3,
CAP_PROP_GPHOTO2_PREVIEW = 17001,
CAP_PROP_GPHOTO2_WIDGET_ENUMERATE = 17002,
CAP_PROP_GPHOTO2_RELOAD_CONFIG = 17003,
CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE = 17004,
CAP_PROP_GPHOTO2_COLLECT_MSGS = 17005,
CAP_PROP_GPHOTO2_FLUSH_MSGS = 17006,
CAP_PROP_SPEED = 17007,
CAP_PROP_APERTURE = 17008,
CAP_PROP_EXPOSUREPROGRAM = 17009,
CAP_PROP_VIEWFINDER = 17010,
CAP_PROP_IMAGES_BASE = 18000,
CAP_PROP_IMAGES_LAST = 19000;
}
| 31,326
|
Java
|
.java
| 671
| 33.825633
| 135
| 0.555033
|
GeekAbdelouahed/sign-language
| 11
| 2
| 1
|
GPL-3.0
|
9/4/2024, 8:24:04 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 31,326
|
1,320,216
|
B.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/PullUp/testFail11/in/B.java
|
package p;
class B extends A {
class P{};
void m() {
P p= new P();
}
}
| 78
|
Java
|
.java
| 7
| 9.142857
| 19
| 0.549296
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 78
|
1,315,070
|
A.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/RenameNonPrivateField/test20/out/A.java
|
package p;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
class A{
List<String> items= new ArrayList<String>();
public List<String> getList() {
return items;
}
public void setList(List<String> list) {
this.items= list;
}
}
class B {
static {
A a= new A();
a.setList(new LinkedList<String>());
List<String> list= a.getList();
list.addAll(a.items);
}
}
| 409
|
Java
|
.java
| 21
| 17.285714
| 45
| 0.71466
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 409
|
1,797,275
|
FlowRegionBreakElement.java
|
git-moss_Push2Display/lib/batik-1.8/sources/org/apache/batik/extension/svg/FlowRegionBreakElement.java
|
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.apache.batik.extension.svg;
import org.apache.batik.anim.dom.SVGOMTextPositioningElement;
import org.apache.batik.dom.AbstractDocument;
import org.w3c.dom.Node;
/**
* This class implements a regular polygon extension to SVG
*
* @author <a href="mailto:[email protected]">Thomas DeWeese</a>
* @version $Id: FlowRegionBreakElement.java 1664314 2015-03-05 11:45:15Z lbernardo $
*/
public class FlowRegionBreakElement
extends SVGOMTextPositioningElement
implements BatikExtConstants {
/**
* Creates a new BatikRegularPolygonElement object.
*/
protected FlowRegionBreakElement() {
}
/**
* Creates a new BatikRegularPolygonElement object.
* @param prefix The namespace prefix.
* @param owner The owner document.
*/
public FlowRegionBreakElement(String prefix, AbstractDocument owner) {
super(prefix, owner);
}
/**
* <b>DOM</b>: Implements {@link org.w3c.dom.Node#getLocalName()}.
*/
public String getLocalName() {
return BATIK_EXT_FLOW_REGION_BREAK_TAG;
}
/**
* <b>DOM</b>: Implements {@link org.w3c.dom.Node#getNamespaceURI()}.
*/
public String getNamespaceURI() {
return BATIK_12_NAMESPACE_URI;
}
/**
* Returns a new uninitialized instance of this object's class.
*/
protected Node newNode() {
return new FlowRegionBreakElement();
}
}
| 2,225
|
Java
|
.java
| 59
| 33.033898
| 85
| 0.724362
|
git-moss/Push2Display
| 16
| 3
| 0
|
LGPL-3.0
|
9/4/2024, 8:19:01 PM (Europe/Amsterdam)
| true
| true
| true
| true
| true
| true
| true
| true
| 2,225
|
3,067,805
|
BlockPlant.java
|
PersianDevs_FeatherMC-Outdated/FeatherMC-Server/src/main/java/net/minecraft/server/BlockPlant.java
|
package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.event.block.BlockPhysicsEvent;
// CraftBukkit end
public class BlockPlant extends Block {
protected BlockPlant() {
this(Material.PLANT);
}
protected BlockPlant(Material material) {
this(material, material.r());
}
protected BlockPlant(Material material, MaterialMapColor materialmapcolor) {
super(material, materialmapcolor);
this.a(true);
float f = 0.2F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3.0F, 0.5F + f);
this.a(CreativeModeTab.c);
}
public boolean canPlace(World world, BlockPosition blockposition) {
return super.canPlace(world, blockposition) && this.c(world.getType(blockposition.down()).getBlock());
}
protected boolean c(Block block) {
return block == Blocks.GRASS || block == Blocks.DIRT || block == Blocks.FARMLAND;
}
public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
super.doPhysics(world, blockposition, iblockdata, block);
this.e(world, blockposition, iblockdata);
}
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
this.e(world, blockposition, iblockdata);
}
protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
if (!this.f(world, blockposition, iblockdata)) {
// CraftBukkit Start
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
BlockPhysicsEvent event = new BlockPhysicsEvent(block, block.getTypeId());
world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
// CraftBukkit end
this.b(world, blockposition, iblockdata, 0);
world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
}
}
public boolean f(World world, BlockPosition blockposition, IBlockData iblockdata) {
return this.c(world.getType(blockposition.down()).getBlock());
}
public AxisAlignedBB a(World world, BlockPosition blockposition, IBlockData iblockdata) {
return null;
}
public boolean c() {
return false;
}
public boolean d() {
return false;
}
}
| 2,525
|
Java
|
.java
| 60
| 34.733333
| 137
| 0.674837
|
PersianDevs/FeatherMC-Outdated
| 5
| 0
| 0
|
GPL-3.0
|
9/4/2024, 10:46:08 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 2,525
|
2,418,244
|
NewVillageFix.java
|
dotexe1337_bdsm-client-1_16/src/main/java/net/minecraft/util/datafix/fixes/NewVillageFix.java
|
package net.minecraft.util.datafix.fixes;
import com.mojang.datafixers.DSL;
import com.mojang.datafixers.DataFix;
import com.mojang.datafixers.DataFixUtils;
import com.mojang.datafixers.OpticFinder;
import com.mojang.datafixers.TypeRewriteRule;
import com.mojang.datafixers.schemas.Schema;
import com.mojang.datafixers.types.Type;
import com.mojang.datafixers.types.templates.CompoundList.CompoundListType;
import com.mojang.datafixers.util.Pair;
import com.mojang.serialization.Dynamic;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import net.minecraft.util.datafix.NamespacedSchema;
import net.minecraft.util.datafix.TypeReferences;
public class NewVillageFix extends DataFix
{
public NewVillageFix(Schema p_i50423_1_, boolean p_i50423_2_)
{
super(p_i50423_1_, p_i50423_2_);
}
protected TypeRewriteRule makeRule()
{
CompoundListType < String, ? > compoundlisttype = DSL.compoundList(DSL.string(), this.getInputSchema().getType(TypeReferences.STRUCTURE_FEATURE));
OpticFinder <? extends List <? extends Pair < String, ? >>> opticfinder = compoundlisttype.finder();
return this.func_219848_a(compoundlisttype);
}
private <SF> TypeRewriteRule func_219848_a(CompoundListType<String, SF> p_219848_1_)
{
Type<?> type = this.getInputSchema().getType(TypeReferences.CHUNK);
Type<?> type1 = this.getInputSchema().getType(TypeReferences.STRUCTURE_FEATURE);
OpticFinder<?> opticfinder = type.findField("Level");
OpticFinder<?> opticfinder1 = opticfinder.type().findField("Structures");
OpticFinder<?> opticfinder2 = opticfinder1.type().findField("Starts");
OpticFinder<List<Pair<String, SF>>> opticfinder3 = p_219848_1_.finder();
return TypeRewriteRule.seq(this.fixTypeEverywhereTyped("NewVillageFix", type, (p_219841_4_) ->
{
return p_219841_4_.updateTyped(opticfinder, (p_219849_3_) -> {
return p_219849_3_.updateTyped(opticfinder1, (p_219842_2_) -> {
return p_219842_2_.updateTyped(opticfinder2, (p_219850_1_) -> {
return p_219850_1_.update(opticfinder3, (p_219851_0_) -> {
return p_219851_0_.stream().filter((p_219854_0_) -> {
return !Objects.equals(p_219854_0_.getFirst(), "Village");
}).map((p_219852_0_) -> {
return p_219852_0_.mapFirst((p_219847_0_) -> {
return p_219847_0_.equals("New_Village") ? "Village" : p_219847_0_;
});
}).collect(Collectors.toList());
});
}).update(DSL.remainderFinder(), (p_219843_0_) -> {
return p_219843_0_.update("References", (p_219844_0_) -> {
Optional <? extends Dynamic<? >> optional = p_219844_0_.get("New_Village").result();
return DataFixUtils.orElse(optional.map((p_219846_1_) -> {
return p_219844_0_.remove("New_Village").set("Village", p_219846_1_);
}), p_219844_0_).remove("Village");
});
});
});
});
}), this.fixTypeEverywhereTyped("NewVillageStartFix", type1, (p_219853_0_) ->
{
return p_219853_0_.update(DSL.remainderFinder(), (p_219840_0_) -> {
return p_219840_0_.update("id", (p_219845_0_) -> {
return Objects.equals(NamespacedSchema.ensureNamespaced(p_219845_0_.asString("")), "minecraft:new_village") ? p_219845_0_.createString("minecraft:village") : p_219845_0_;
});
});
}));
}
}
| 3,874
|
Java
|
.java
| 71
| 42.577465
| 190
| 0.600684
|
dotexe1337/bdsm-client-1.16
| 8
| 1
| 1
|
GPL-2.0
|
9/4/2024, 9:22:36 PM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| false
| true
| true
| 3,874
|
2,659,442
|
ExtendedWorkspace.java
|
exoplatform_jcr/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ExtendedWorkspace.java
|
/*
* Copyright (C) 2009 eXo Platform SAS.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.exoplatform.services.jcr.core;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import javax.jcr.InvalidSerializedDataException;
import javax.jcr.ItemExistsException;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.Workspace;
import javax.jcr.nodetype.ConstraintViolationException;
/**
* ExtendedWorkspace extends Workspace interface provide import function.
*
* @author <a href="mailto:[email protected]">Sergey Kabashnyuk</a>
* @version $Id: ExtendedWorkspace.java 12649 2008-04-02 12:46:37Z ksm $
* @LevelAPI Experimental
*/
public interface ExtendedWorkspace extends Workspace
{
/**
* Deserializes an XML document and adds the resulting item subtree as a child of the node at
* parentAbsPath.
*
* @param parentAbsPath
* the absolute path of the node below which the deserialized subtree is added.
* @param in
* The <code>Inputstream</code> from which the XML to be deserilaized is read.
* @param uuidBehavior
* a four-value flag that governs how incoming UUIDs are handled.
* @param context
* @throws IOException
* @throws PathNotFoundException
* @throws ItemExistsException
* @throws ConstraintViolationException
* @throws InvalidSerializedDataException
* @throws RepositoryException
*/
void importXML(String parentAbsPath, InputStream in, int uuidBehavior, Map<String, Object> context)
throws IOException, PathNotFoundException, ItemExistsException, ConstraintViolationException,
InvalidSerializedDataException, RepositoryException;
/**
* Returns {@link NodeTypeDataManager} instance
*
* @return NodeTypeDataManager
* @throws RepositoryException
*/
NodeTypeDataManager getNodeTypesHolder() throws RepositoryException;
}
| 2,773
|
Java
|
.java
| 67
| 38.238806
| 102
| 0.768433
|
exoplatform/jcr
| 6
| 20
| 1
|
AGPL-3.0
|
9/4/2024, 10:01:50 PM (Europe/Amsterdam)
| false
| false
| false
| true
| false
| false
| false
| true
| 2,773
|
1,512,003
|
RenderPolarBear.java
|
josephworks_AtomMC/src/main/java/net/minecraft/client/renderer/entity/RenderPolarBear.java
|
package net.minecraft.client.renderer.entity;
import net.minecraft.client.model.ModelPolarBear;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.monster.EntityPolarBear;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderPolarBear extends RenderLiving<EntityPolarBear> {
private static final ResourceLocation POLAR_BEAR_TEXTURE = new ResourceLocation("textures/entity/bear/polarbear.png");
public RenderPolarBear(RenderManager p_i47197_1_) {
super(p_i47197_1_, new ModelPolarBear(), 0.7F);
}
protected ResourceLocation getEntityTexture(EntityPolarBear entity) {
return POLAR_BEAR_TEXTURE;
}
public void doRender(EntityPolarBear entity, double x, double y, double z, float entityYaw, float partialTicks) {
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
protected void preRenderCallback(EntityPolarBear entitylivingbaseIn, float partialTickTime) {
GlStateManager.scale(1.2F, 1.2F, 1.2F);
super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
}
| 1,211
|
Java
|
.java
| 24
| 46.083333
| 122
| 0.788494
|
josephworks/AtomMC
| 23
| 6
| 21
|
GPL-3.0
|
9/4/2024, 7:55:18 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 1,211
|
1,319,452
|
A_test713.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/return_out/A_test713.java
|
package return_out;
public class A_test713 {
public java.util.List foo() {
return extracted();
}
protected java.util.List extracted() {
/*[*/return null;/*]*/
}
}
| 173
|
Java
|
.java
| 9
| 17.111111
| 39
| 0.685185
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 173
|
1,525,782
|
TypeAnnotationParser.java
|
nilsvanvelzen_mac_ppc_openjdk8u60/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java
|
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.reflect.annotation;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.nio.ByteBuffer;
import java.nio.BufferUnderflowException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import sun.misc.JavaLangAccess;
import sun.reflect.ConstantPool;
import static sun.reflect.annotation.TypeAnnotation.*;
/**
* TypeAnnotationParser implements the logic needed to parse
* TypeAnnotations from an array of bytes.
*/
public final class TypeAnnotationParser {
private static final TypeAnnotation[] EMPTY_TYPE_ANNOTATION_ARRAY = new TypeAnnotation[0];
/**
* Build an AnnotatedType from the parameters supplied.
*
* This method and {@code buildAnnotatedTypes} are probably
* the entry points you are looking for.
*
* @param rawAnnotations the byte[] encoding of all type annotations on this declaration
* @param cp the ConstantPool needed to parse the embedded Annotation
* @param decl the declaration this type annotation is on
* @param container the Class this type annotation is on (may be the same as decl)
* @param type the type the AnnotatedType corresponds to
* @param filter the type annotation targets included in this AnnotatedType
*/
public static AnnotatedType buildAnnotatedType(byte[] rawAnnotations,
ConstantPool cp,
AnnotatedElement decl,
Class<?> container,
Type type,
TypeAnnotationTarget filter) {
TypeAnnotation[] tas = parseTypeAnnotations(rawAnnotations,
cp,
decl,
container);
List<TypeAnnotation> l = new ArrayList<>(tas.length);
for (TypeAnnotation t : tas) {
TypeAnnotationTargetInfo ti = t.getTargetInfo();
if (ti.getTarget() == filter)
l.add(t);
}
TypeAnnotation[] typeAnnotations = l.toArray(EMPTY_TYPE_ANNOTATION_ARRAY);
return AnnotatedTypeFactory.buildAnnotatedType(type,
LocationInfo.BASE_LOCATION,
typeAnnotations,
typeAnnotations,
decl);
}
/**
* Build an array of AnnotatedTypes from the parameters supplied.
*
* This method and {@code buildAnnotatedType} are probably
* the entry points you are looking for.
*
* @param rawAnnotations the byte[] encoding of all type annotations on this declaration
* @param cp the ConstantPool needed to parse the embedded Annotation
* @param decl the declaration this type annotation is on
* @param container the Class this type annotation is on (may be the same as decl)
* @param types the Types the AnnotatedTypes corresponds to
* @param filter the type annotation targets that included in this AnnotatedType
*/
public static AnnotatedType[] buildAnnotatedTypes(byte[] rawAnnotations,
ConstantPool cp,
AnnotatedElement decl,
Class<?> container,
Type[] types,
TypeAnnotationTarget filter) {
int size = types.length;
AnnotatedType[] result = new AnnotatedType[size];
Arrays.fill(result, AnnotatedTypeFactory.EMPTY_ANNOTATED_TYPE);
@SuppressWarnings("rawtypes")
ArrayList[] l = new ArrayList[size]; // array of ArrayList<TypeAnnotation>
TypeAnnotation[] tas = parseTypeAnnotations(rawAnnotations,
cp,
decl,
container);
for (TypeAnnotation t : tas) {
TypeAnnotationTargetInfo ti = t.getTargetInfo();
if (ti.getTarget() == filter) {
int pos = ti.getCount();
if (l[pos] == null) {
ArrayList<TypeAnnotation> tmp = new ArrayList<>(tas.length);
l[pos] = tmp;
}
@SuppressWarnings("unchecked")
ArrayList<TypeAnnotation> tmp = l[pos];
tmp.add(t);
}
}
for (int i = 0; i < size; i++) {
@SuppressWarnings("unchecked")
ArrayList<TypeAnnotation> list = l[i];
TypeAnnotation[] typeAnnotations;
if (list != null) {
typeAnnotations = list.toArray(new TypeAnnotation[list.size()]);
} else {
typeAnnotations = EMPTY_TYPE_ANNOTATION_ARRAY;
}
result[i] = AnnotatedTypeFactory.buildAnnotatedType(types[i],
LocationInfo.BASE_LOCATION,
typeAnnotations,
typeAnnotations,
decl);
}
return result;
}
// Class helpers
/**
* Build an AnnotatedType for the class decl's supertype.
*
* @param rawAnnotations the byte[] encoding of all type annotations on this declaration
* @param cp the ConstantPool needed to parse the embedded Annotation
* @param decl the Class which annotated supertype is being built
*/
public static AnnotatedType buildAnnotatedSuperclass(byte[] rawAnnotations,
ConstantPool cp,
Class<?> decl) {
Type supertype = decl.getGenericSuperclass();
if (supertype == null)
return AnnotatedTypeFactory.EMPTY_ANNOTATED_TYPE;
return buildAnnotatedType(rawAnnotations,
cp,
decl,
decl,
supertype,
TypeAnnotationTarget.CLASS_EXTENDS);
}
/**
* Build an array of AnnotatedTypes for the class decl's implemented
* interfaces.
*
* @param rawAnnotations the byte[] encoding of all type annotations on this declaration
* @param cp the ConstantPool needed to parse the embedded Annotation
* @param decl the Class whose annotated implemented interfaces is being built
*/
public static AnnotatedType[] buildAnnotatedInterfaces(byte[] rawAnnotations,
ConstantPool cp,
Class<?> decl) {
if (decl == Object.class ||
decl.isArray() ||
decl.isPrimitive() ||
decl == Void.TYPE)
return AnnotatedTypeFactory.EMPTY_ANNOTATED_TYPE_ARRAY;
return buildAnnotatedTypes(rawAnnotations,
cp,
decl,
decl,
decl.getGenericInterfaces(),
TypeAnnotationTarget.CLASS_IMPLEMENTS);
}
// TypeVariable helpers
/**
* Parse regular annotations on a TypeVariable declared on genericDecl.
*
* Regular Annotations on TypeVariables are stored in the type
* annotation byte[] in the class file.
*
* @param genericsDecl the declaration declaring the type variable
* @param typeVarIndex the 0-based index of this type variable in the declaration
*/
public static <D extends GenericDeclaration> Annotation[] parseTypeVariableAnnotations(D genericDecl,
int typeVarIndex) {
AnnotatedElement decl;
TypeAnnotationTarget predicate;
if (genericDecl instanceof Class) {
decl = (Class<?>)genericDecl;
predicate = TypeAnnotationTarget.CLASS_TYPE_PARAMETER;
} else if (genericDecl instanceof Executable) {
decl = (Executable)genericDecl;
predicate = TypeAnnotationTarget.METHOD_TYPE_PARAMETER;
} else {
throw new AssertionError("Unknown GenericDeclaration " + genericDecl + "\nthis should not happen.");
}
List<TypeAnnotation> typeVarAnnos = TypeAnnotation.filter(parseAllTypeAnnotations(decl),
predicate);
List<Annotation> res = new ArrayList<>(typeVarAnnos.size());
for (TypeAnnotation t : typeVarAnnos)
if (t.getTargetInfo().getCount() == typeVarIndex)
res.add(t.getAnnotation());
return res.toArray(new Annotation[0]);
}
/**
* Build an array of AnnotatedTypes for the declaration decl's bounds.
*
* @param bounds the bounds corresponding to the annotated bounds
* @param decl the declaration whose annotated bounds is being built
* @param typeVarIndex the index of this type variable on the decl
*/
public static <D extends GenericDeclaration> AnnotatedType[] parseAnnotatedBounds(Type[] bounds,
D decl,
int typeVarIndex) {
return parseAnnotatedBounds(bounds, decl, typeVarIndex, LocationInfo.BASE_LOCATION);
}
//helper for above
private static <D extends GenericDeclaration> AnnotatedType[] parseAnnotatedBounds(Type[] bounds,
D decl,
int typeVarIndex,
LocationInfo loc) {
List<TypeAnnotation> candidates = fetchBounds(decl);
if (bounds != null) {
int startIndex = 0;
AnnotatedType[] res = new AnnotatedType[bounds.length];
// Adjust bounds index
//
// Figure out if the type annotations for this bound starts with 0
// or 1. The spec says within a bound the 0:th type annotation will
// always be on an bound of a Class type (not Interface type). So
// if the programmer starts with an Interface type for the first
// (and following) bound(s) the implicit Object bound is considered
// the first (that is 0:th) bound and type annotations start on
// index 1.
if (bounds.length > 0) {
Type b0 = bounds[0];
if (!(b0 instanceof Class<?>)) {
startIndex = 1;
} else {
Class<?> c = (Class<?>)b0;
if (c.isInterface()) {
startIndex = 1;
}
}
}
for (int i = 0; i < bounds.length; i++) {
List<TypeAnnotation> l = new ArrayList<>(candidates.size());
for (TypeAnnotation t : candidates) {
TypeAnnotationTargetInfo tInfo = t.getTargetInfo();
if (tInfo.getSecondaryIndex() == i + startIndex &&
tInfo.getCount() == typeVarIndex) {
l.add(t);
}
}
res[i] = AnnotatedTypeFactory.buildAnnotatedType(bounds[i],
loc,
l.toArray(EMPTY_TYPE_ANNOTATION_ARRAY),
candidates.toArray(EMPTY_TYPE_ANNOTATION_ARRAY),
(AnnotatedElement)decl);
}
return res;
}
return new AnnotatedType[0];
}
private static <D extends GenericDeclaration> List<TypeAnnotation> fetchBounds(D decl) {
AnnotatedElement boundsDecl;
TypeAnnotationTarget target;
if (decl instanceof Class) {
target = TypeAnnotationTarget.CLASS_TYPE_PARAMETER_BOUND;
boundsDecl = (Class)decl;
} else {
target = TypeAnnotationTarget.METHOD_TYPE_PARAMETER_BOUND;
boundsDecl = (Executable)decl;
}
return TypeAnnotation.filter(TypeAnnotationParser.parseAllTypeAnnotations(boundsDecl), target);
}
/*
* Parse all type annotations on the declaration supplied. This is needed
* when you go from for example an annotated return type on a method that
* is a type variable declared on the class. In this case you need to
* 'jump' to the decl of the class and parse all type annotations there to
* find the ones that are applicable to the type variable.
*/
static TypeAnnotation[] parseAllTypeAnnotations(AnnotatedElement decl) {
Class<?> container;
byte[] rawBytes;
JavaLangAccess javaLangAccess = sun.misc.SharedSecrets.getJavaLangAccess();
if (decl instanceof Class) {
container = (Class<?>)decl;
rawBytes = javaLangAccess.getRawClassTypeAnnotations(container);
} else if (decl instanceof Executable) {
container = ((Executable)decl).getDeclaringClass();
rawBytes = javaLangAccess.getRawExecutableTypeAnnotations((Executable)decl);
} else {
// Should not reach here. Assert?
return EMPTY_TYPE_ANNOTATION_ARRAY;
}
return parseTypeAnnotations(rawBytes, javaLangAccess.getConstantPool(container),
decl, container);
}
/* Parse type annotations encoded as an array of bytes */
private static TypeAnnotation[] parseTypeAnnotations(byte[] rawAnnotations,
ConstantPool cp,
AnnotatedElement baseDecl,
Class<?> container) {
if (rawAnnotations == null)
return EMPTY_TYPE_ANNOTATION_ARRAY;
ByteBuffer buf = ByteBuffer.wrap(rawAnnotations);
int annotationCount = buf.getShort() & 0xFFFF;
List<TypeAnnotation> typeAnnotations = new ArrayList<>(annotationCount);
// Parse each TypeAnnotation
for (int i = 0; i < annotationCount; i++) {
TypeAnnotation ta = parseTypeAnnotation(buf, cp, baseDecl, container);
if (ta != null)
typeAnnotations.add(ta);
}
return typeAnnotations.toArray(EMPTY_TYPE_ANNOTATION_ARRAY);
}
// Helper
static Map<Class<? extends Annotation>, Annotation> mapTypeAnnotations(TypeAnnotation[] typeAnnos) {
Map<Class<? extends Annotation>, Annotation> result =
new LinkedHashMap<>();
for (TypeAnnotation t : typeAnnos) {
Annotation a = t.getAnnotation();
Class<? extends Annotation> klass = a.annotationType();
AnnotationType type = AnnotationType.getInstance(klass);
if (type.retention() == RetentionPolicy.RUNTIME)
if (result.put(klass, a) != null)
throw new AnnotationFormatError("Duplicate annotation for class: "+klass+": " + a);
}
return result;
}
// Position codes
// Regular type parameter annotations
private static final byte CLASS_TYPE_PARAMETER = 0x00;
private static final byte METHOD_TYPE_PARAMETER = 0x01;
// Type Annotations outside method bodies
private static final byte CLASS_EXTENDS = 0x10;
private static final byte CLASS_TYPE_PARAMETER_BOUND = 0x11;
private static final byte METHOD_TYPE_PARAMETER_BOUND = 0x12;
private static final byte FIELD = 0x13;
private static final byte METHOD_RETURN = 0x14;
private static final byte METHOD_RECEIVER = 0x15;
private static final byte METHOD_FORMAL_PARAMETER = 0x16;
private static final byte THROWS = 0x17;
// Type Annotations inside method bodies
private static final byte LOCAL_VARIABLE = (byte)0x40;
private static final byte RESOURCE_VARIABLE = (byte)0x41;
private static final byte EXCEPTION_PARAMETER = (byte)0x42;
private static final byte INSTANCEOF = (byte)0x43;
private static final byte NEW = (byte)0x44;
private static final byte CONSTRUCTOR_REFERENCE = (byte)0x45;
private static final byte METHOD_REFERENCE = (byte)0x46;
private static final byte CAST = (byte)0x47;
private static final byte CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT = (byte)0x48;
private static final byte METHOD_INVOCATION_TYPE_ARGUMENT = (byte)0x49;
private static final byte CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = (byte)0x4A;
private static final byte METHOD_REFERENCE_TYPE_ARGUMENT = (byte)0x4B;
private static TypeAnnotation parseTypeAnnotation(ByteBuffer buf,
ConstantPool cp,
AnnotatedElement baseDecl,
Class<?> container) {
try {
TypeAnnotationTargetInfo ti = parseTargetInfo(buf);
LocationInfo locationInfo = LocationInfo.parseLocationInfo(buf);
Annotation a = AnnotationParser.parseAnnotation(buf, cp, container, false);
if (ti == null) // Inside a method for example
return null;
return new TypeAnnotation(ti, locationInfo, a, baseDecl);
} catch (IllegalArgumentException | // Bad type in const pool at specified index
BufferUnderflowException e) {
throw new AnnotationFormatError(e);
}
}
private static TypeAnnotationTargetInfo parseTargetInfo(ByteBuffer buf) {
int posCode = buf.get() & 0xFF;
switch(posCode) {
case CLASS_TYPE_PARAMETER:
case METHOD_TYPE_PARAMETER: {
int index = buf.get() & 0xFF;
TypeAnnotationTargetInfo res;
if (posCode == CLASS_TYPE_PARAMETER)
res = new TypeAnnotationTargetInfo(TypeAnnotationTarget.CLASS_TYPE_PARAMETER,
index);
else
res = new TypeAnnotationTargetInfo(TypeAnnotationTarget.METHOD_TYPE_PARAMETER,
index);
return res;
} // unreachable break;
case CLASS_EXTENDS: {
short index = buf.getShort(); //needs to be signed
if (index == -1) {
return new TypeAnnotationTargetInfo(TypeAnnotationTarget.CLASS_EXTENDS);
} else if (index >= 0) {
TypeAnnotationTargetInfo res = new TypeAnnotationTargetInfo(TypeAnnotationTarget.CLASS_IMPLEMENTS,
index);
return res;
}} break;
case CLASS_TYPE_PARAMETER_BOUND:
return parse2ByteTarget(TypeAnnotationTarget.CLASS_TYPE_PARAMETER_BOUND, buf);
case METHOD_TYPE_PARAMETER_BOUND:
return parse2ByteTarget(TypeAnnotationTarget.METHOD_TYPE_PARAMETER_BOUND, buf);
case FIELD:
return new TypeAnnotationTargetInfo(TypeAnnotationTarget.FIELD);
case METHOD_RETURN:
return new TypeAnnotationTargetInfo(TypeAnnotationTarget.METHOD_RETURN);
case METHOD_RECEIVER:
return new TypeAnnotationTargetInfo(TypeAnnotationTarget.METHOD_RECEIVER);
case METHOD_FORMAL_PARAMETER: {
int index = buf.get() & 0xFF;
return new TypeAnnotationTargetInfo(TypeAnnotationTarget.METHOD_FORMAL_PARAMETER,
index);
} //unreachable break;
case THROWS:
return parseShortTarget(TypeAnnotationTarget.THROWS, buf);
/*
* The ones below are inside method bodies, we don't care about them for core reflection
* other than adjusting for them in the byte stream.
*/
case LOCAL_VARIABLE:
case RESOURCE_VARIABLE:
short length = buf.getShort();
for (int i = 0; i < length; ++i) {
short offset = buf.getShort();
short varLength = buf.getShort();
short index = buf.getShort();
}
return null;
case EXCEPTION_PARAMETER: {
byte index = buf.get();
}
return null;
case INSTANCEOF:
case NEW:
case CONSTRUCTOR_REFERENCE:
case METHOD_REFERENCE: {
short offset = buf.getShort();
}
return null;
case CAST:
case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
case METHOD_INVOCATION_TYPE_ARGUMENT:
case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
case METHOD_REFERENCE_TYPE_ARGUMENT: {
short offset = buf.getShort();
byte index = buf.get();
}
return null;
default:
// will throw error below
break;
}
throw new AnnotationFormatError("Could not parse bytes for type annotations");
}
private static TypeAnnotationTargetInfo parseShortTarget(TypeAnnotationTarget target, ByteBuffer buf) {
int index = buf.getShort() & 0xFFFF;
return new TypeAnnotationTargetInfo(target, index);
}
private static TypeAnnotationTargetInfo parse2ByteTarget(TypeAnnotationTarget target, ByteBuffer buf) {
int count = buf.get() & 0xFF;
int secondaryIndex = buf.get() & 0xFF;
return new TypeAnnotationTargetInfo(target,
count,
secondaryIndex);
}
}
| 22,281
|
Java
|
.java
| 475
| 34.951579
| 114
| 0.612315
|
nilsvanvelzen/mac_ppc_openjdk8u60
| 21
| 3
| 2
|
GPL-2.0
|
9/4/2024, 7:56:33 PM (Europe/Amsterdam)
| false
| true
| true
| true
| true
| true
| true
| true
| 22,281
|
2,385,040
|
ParameterValidator.java
|
networknt_openapi-parser/src/main/java/com/networknt/oas/validator/impl/ParameterValidator.java
|
/*******************************************************************************
* Copyright (c) 2017 ModelSolv, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* ModelSolv, Inc. - initial API and implementation and/or initial documentation
*******************************************************************************/
package com.networknt.oas.validator.impl;
import com.networknt.jsonoverlay.Overlay;
import com.networknt.jsonoverlay.PropertiesOverlay;
import com.networknt.oas.model.*;
import com.networknt.oas.validator.ObjectValidatorBase;
import java.util.Map;
import static com.networknt.oas.model.impl.ParameterImpl.*;
import static com.networknt.oas.validator.impl.OpenApi3Messages.NoPath;
import static com.networknt.oas.validator.impl.OpenApi3Messages.PathParamReq;
import static com.networknt.oas.validator.msg.Messages.msg;
public class ParameterValidator extends ObjectValidatorBase<Parameter> {
@Override
public void runObjectValidations() {
Parameter parameter = (Parameter) value.getOverlay();
validateStringField(F_description, false);
validateBooleanField(F_deprecated, false);
validateBooleanField(F_allowEmptyValue, false);
validateBooleanField(F_explode, false);
Overlay<Object> example = validateField(F_example, false, Object.class, null);
Overlay<Map<String, Example>> examples = validateMapField(F_examples, false, false, Example.class,
new ExampleValidator());
checkExampleExclusion(examples, example);
validateStringField(F_name, true);
validateStringField(F_in, true, Regexes.PARAM_IN_REGEX);
checkPathParam(parameter);
checkRequired(parameter);
validateStringField(F_style, false, Regexes.STYLE_REGEX);
checkAllowReserved(parameter);
// TODO Q: Should schema be required in parameter object?
validateField(F_schema, false, Schema.class, new SchemaValidator());
validateMapField(F_contentMediaTypes, false, false, MediaType.class, new MediaTypeValidator());
validateExtensions(parameter.getExtensions());
}
private void checkPathParam(Parameter parameter) {
if (parameter.getIn() != null && parameter.getIn().equals("path") && parameter.getName() != null) {
String path = getPathString(parameter);
if (path != null) {
if (!path.matches(".*/\\{" + parameter.getName() + "\\}(/.*)?")) {
results.addError(msg(OpenApi3Messages.MissingPathTplt, parameter.getName(), path), value);
}
} else {
results.addWarning(msg(NoPath, parameter.getName(), parameter.getIn()), value);
}
}
}
private void checkRequired(Parameter parameter) {
if ("path".equals(parameter.getIn())) {
if (parameter.getRequired() != Boolean.TRUE) {
results.addError(msg(PathParamReq, parameter.getName()), value);
}
}
}
private void checkAllowReserved(Parameter parameter) {
if (parameter.isAllowReserved() && !"query".equals(parameter.getIn())) {
results.addWarning(msg(OpenApi3Messages.NonQryAllowRsvd, parameter.getName(), parameter.getIn()), value);
}
}
private String getPathString(Parameter parameter) {
PropertiesOverlay<?> parent = Overlay.of(parameter).getParentPropertiesOverlay();
while (parent != null && !(parent instanceof Path)) {
parent = Overlay.of(parent).getParentPropertiesOverlay();
}
return parent != null && parent instanceof Path ? Overlay.getPathInParent(parent) : null;
}
void checkExampleExclusion(Overlay<Map<String, Example>> examples, Overlay<Object> example) {
boolean examplesPresent = examples != null && examples.isPresent()
&& Overlay.getMapOverlay(examples).size() > 0;
boolean examplePresent = example != null && example.isPresent();
if (examplesPresent && examplePresent) {
results.addError("ExmplExclusion|The 'example' and 'exmaples' properties may not both appear", value);
}
}
}
| 4,005
|
Java
|
.java
| 83
| 45.421687
| 108
| 0.733129
|
networknt/openapi-parser
| 8
| 7
| 2
|
EPL-1.0
|
9/4/2024, 9:16:59 PM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| false
| true
| true
| 4,005
|
1,315,088
|
A.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/RenameNonPrivateField/test19/out/A.java
|
package p;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
class A{
List<String> items= new ArrayList<String>();
public List<String> getItems() {
return items;
}
public void setItems(List<String> list) {
this.items= list;
}
}
class B {
static {
A a= new A();
a.setItems(new LinkedList<String>());
List<String> list= a.getItems();
list.addAll(a.items);
}
}
| 413
|
Java
|
.java
| 21
| 17.47619
| 45
| 0.717617
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 413
|
13,785
|
package-info.java
|
checkstyle_checkstyle/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/missingjavadocpackage/package-info.java
|
/*
MissingJavadocPackage
*/
/**
* javadoc
*/
@Deprecated
package com.puppycrawl.tools.checkstyle.checks.javadoc.missingjavadocpackage; // ok
| 149
|
Java
|
.java
| 8
| 16.625
| 83
| 0.807407
|
checkstyle/checkstyle
| 8,277
| 3,649
| 906
|
LGPL-2.1
|
9/4/2024, 7:04:55 PM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| true
| true
| true
| 149
|
1,319,061
|
A_test570.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/locals_in/A_test570.java
|
package locals_in;
public class A_test570 {
public void foo() {
Object[] a= null;
int i= 0;
for(Object element: a) {
/*[*/i++;/*]*/
}
}
}
| 154
|
Java
|
.java
| 10
| 12.8
| 26
| 0.574468
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 154
|
1,318,351
|
A_test281.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/SelectionAnalyzerWorkSpace/SelectionAnalyzerTests/validSelection/A_test281.java
|
package validSelection;
public class A_test281 {
public boolean fBoolean;
public void foo() {
if (fBoolean)
/*]*/foo()/*[*/;
else
foo();
}
}
| 154
|
Java
|
.java
| 10
| 13.1
| 25
| 0.652778
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 154
|
3,068,594
|
FileExtensionFilterComposite.java
|
Tostis_areca/src/main/java/com/application/areca/launcher/gui/filters/FileExtensionFilterComposite.java
|
package com.application.areca.launcher.gui.filters;
import org.eclipse.swt.widgets.Composite;
import com.application.areca.filter.ArchiveFilter;
import com.application.areca.filter.FileExtensionArchiveFilter;
import com.application.areca.launcher.gui.FilterEditionWindow;
import com.application.areca.launcher.gui.FilterRepository;
/**
* <BR>
* @author Olivier PETRUCCI
* <BR>
*
*/
/*
Copyright 2005-2015, Olivier PETRUCCI.
This file is part of Areca.
Areca is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Areca is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Areca; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
public class FileExtensionFilterComposite extends AbstractSimpleParamFilterComposite {
private static final String EXAMPLE_FILEEXTENSION = RM.getLabel("filteredition.examplefileext.label");
public FileExtensionFilterComposite(Composite composite, ArchiveFilter filter, FilterEditionWindow window) {
super(composite, FilterRepository.getIndex(FileExtensionArchiveFilter.class), filter, window);
}
public String getParamExample() {
return EXAMPLE_FILEEXTENSION;
}
}
| 1,680
|
Java
|
.java
| 36
| 42.694444
| 112
| 0.786986
|
Tostis/areca
| 5
| 0
| 3
|
GPL-2.0
|
9/4/2024, 10:46:08 PM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| false
| true
| 1,680
|
3,233,369
|
RomanNumeralAnnotation_Type.java
|
OHNLP_MedTime/src/main/java/org/ohnlp/typesystem/type/textsem/RomanNumeralAnnotation_Type.java
|
/*******************************************************************************
* Copyright: (c) 2013 Mayo Foundation for Medical Education and
* Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
* triple-shield Mayo logo are trademarks and service marks of MFMER.
*
* Except as contained in the copyright notice above, or as used to identify
* MFMER as the author of this software, the trade names, trademarks, service
* marks, or product names of the copyright holder shall not be used in
* advertising, promotion or otherwise in connection with this software without
* prior written authorization of the copyright holder.
*
* MedTime is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* MedTime is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MedTime. If not, see http://www.gnu.org/licenses/.
*
*******************************************************************************/
/* First created by JCasGen Sun Sep 29 06:04:08 CDT 2013 */
package org.ohnlp.typesystem.type.textsem;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FSGenerator;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
/** Equivalent to Mayo cTAKES version 2.5: edu.mayo.bmi.uima.cdt.type.RomanNumeralAnnotation
* Updated by JCasGen Sun Sep 29 06:07:12 CDT 2013
* @generated */
public class RomanNumeralAnnotation_Type extends IdentifiedAnnotation_Type {
/** @generated */
@Override
protected FSGenerator getFSGenerator() {return fsGenerator;}
/** @generated */
private final FSGenerator fsGenerator =
new FSGenerator() {
public FeatureStructure createFS(int addr, CASImpl cas) {
if (RomanNumeralAnnotation_Type.this.useExistingInstance) {
// Return eq fs instance if already created
FeatureStructure fs = RomanNumeralAnnotation_Type.this.jcas.getJfsFromCaddr(addr);
if (null == fs) {
fs = new RomanNumeralAnnotation(addr, RomanNumeralAnnotation_Type.this);
RomanNumeralAnnotation_Type.this.jcas.putJfsFromCaddr(addr, fs);
return fs;
}
return fs;
} else return new RomanNumeralAnnotation(addr, RomanNumeralAnnotation_Type.this);
}
};
/** @generated */
@SuppressWarnings ("hiding")
public final static int typeIndexID = RomanNumeralAnnotation.typeIndexID;
/** @generated
@modifiable */
@SuppressWarnings ("hiding")
public final static boolean featOkTst = JCasRegistry.getFeatOkTst("org.ohnlp.typesystem.type.textsem.RomanNumeralAnnotation");
/** initialize variables to correspond with Cas Type and Features
* @generated */
public RomanNumeralAnnotation_Type(JCas jcas, Type casType) {
super(jcas, casType);
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
}
}
| 3,426
|
Java
|
.java
| 69
| 45.753623
| 128
| 0.71732
|
OHNLP/MedTime
| 4
| 0
| 1
|
GPL-3.0
|
9/4/2024, 11:06:59 PM (Europe/Amsterdam)
| false
| true
| false
| true
| true
| true
| true
| true
| 3,426
|
4,536,273
|
b.java
|
nadinCodeHat_MyDialog_14_1_1/sources/androidx/appcompat/app/b.java
|
package androidx.appcompat.app;
/* compiled from: ActionBarDrawerToggle */
public interface b {
}
| 99
|
Java
|
.java
| 4
| 23.5
| 42
| 0.808511
|
nadinCodeHat/MyDialog_14.1.1
| 2
| 1
| 0
|
GPL-2.0
|
9/5/2024, 12:16:26 AM (Europe/Amsterdam)
| false
| false
| false
| true
| false
| false
| false
| true
| 99
|
2,910,644
|
Configure.java
|
riedlse_RXTXcomm/src/gnu/io/Configure.java
|
/*-------------------------------------------------------------------------
| RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface.
| RXTX is a native interface to serial ports in java.
| Copyright 1997-2007 by Trent Jarvi [email protected] and others who
| actually wrote it. See individual source files for more information.
|
| A copy of the LGPL v 2.1 may be found at
| http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is
| here for your convenience.
|
| This library is free software; you can redistribute it and/or
| modify it under the terms of the GNU Lesser General Public
| License as published by the Free Software Foundation; either
| version 2.1 of the License, or (at your option) any later version.
|
| This library is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
| Lesser General Public License for more details.
|
| An executable that contains no derivative of any portion of RXTX, but
| is designed to work with RXTX by being dynamically linked with it,
| is considered a "work that uses the Library" subject to the terms and
| conditions of the GNU Lesser General Public License.
|
| The following has been added to the RXTX License to remove
| any confusion about linking to RXTX. We want to allow in part what
| section 5, paragraph 2 of the LGPL does not permit in the special
| case of linking over a controlled interface. The intent is to add a
| Java Specification Request or standards body defined interface in the
| future as another exception but one is not currently available.
|
| http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface
|
| As a special exception, the copyright holders of RXTX give you
| permission to link RXTX with independent modules that communicate with
| RXTX solely through the Sun Microsytems CommAPI interface version 2,
| regardless of the license terms of these independent modules, and to copy
| and distribute the resulting combined work under terms of your choice,
| provided that every copy of the combined work is accompanied by a complete
| copy of the source code of RXTX (the version of RXTX used to produce the
| combined work), being distributed under the terms of the GNU Lesser General
| Public License plus this exception. An independent module is a
| module which is not derived from or based on RXTX.
|
| Note that people who make modified versions of RXTX are not obligated
| to grant this special exception for their modified versions; it is
| their choice whether to do so. The GNU Lesser General Public License
| gives permission to release a modified version without this exception; this
| exception also makes it possible to release a modified version which
| carries forward this exception.
|
| You should have received a copy of the GNU Lesser General Public
| License along with this library; if not, write to the Free
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
| All trademarks belong to their respective owners.
--------------------------------------------------------------------------*/
package gnu.io;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
class Configure extends Frame
{
Checkbox cb[];
Panel p1;
static final int PORT_SERIAL = 1;
static final int PORT_PARALLEL = 2;
int PortType = PORT_SERIAL;
private void saveSpecifiedPorts()
{
String filename;
String javaHome= System.getProperty( "java.home" );
String pathSep = System.getProperty( "path.separator", ":" );
String fileSep = System.getProperty( "file.separator", "/" );
String lineSep = System.getProperty( "line.separator" );
String output;
if( PortType == PORT_SERIAL )
filename = javaHome +
fileSep + "lib" + fileSep +
"gnu.io.rxtx.SerialPorts";
else if ( PortType == PORT_PARALLEL )
filename = javaHome +
"gnu.io.rxtx.ParallelPorts";
else
{
System.out.println( "Bad Port Type!" );
return;
}
System.out.println(filename);
try {
FileOutputStream out = new FileOutputStream( filename );
for( int i = 0; i < 128; i++)
{
if( cb[i].getState() )
{
output = cb[i].getLabel() +
pathSep;
out.write( output.getBytes() );
}
}
out.write(lineSep.getBytes());
out.close();
}
catch ( IOException e )
{
System.out.println("IOException!");
}
}
void addCheckBoxes( String PortName )
{
for ( int i = 0; i < 128 ; i++ )
if( cb[i] != null )
p1.remove( cb[i] );
for (int i=1;i<129;i++)
{
cb[i-1]=new Checkbox(PortName+i);
p1.add( "NORTH", cb[i-1] );
}
}
public Configure()
{
int Width= 640;
int Height= 480;
cb = new Checkbox[128];
final Frame f = new Frame(
"Configure gnu.io.rxtx.properties");
String fileSep = System.getProperty( "file.separator", "/" );
String devPath;
if( fileSep.compareTo( "/" ) != 0 )
devPath="COM";
else
devPath="/dev/";
f.setBounds(100,50,Width,Height);
f.setLayout(new BorderLayout());
p1 = new Panel();
p1.setLayout(new GridLayout(16,4));
ActionListener l = new ActionListener() {
public void actionPerformed( ActionEvent e ) {
{
String res = e.getActionCommand();
if ( res.equals( "Save" ) )
saveSpecifiedPorts();
}
}
};
addCheckBoxes( devPath );
TextArea t = new TextArea( EnumMessage, 5, 50,
TextArea.SCROLLBARS_NONE );
t.setSize(50,Width);
t.setEditable(false);
final Panel p2 = new Panel();
p2.add(new Label("Port Name:"));
TextField tf = new TextField(devPath, 8);
tf.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e )
{
addCheckBoxes(e.getActionCommand());
f.setVisible(true);
}
});
p2.add(tf);
Checkbox Keep = new Checkbox("Keep Ports");
p2.add(Keep);
Button b[] = new Button[6];
for(int j=0, i = 4;i<129;i*=2, j++)
{
b[j] = new Button("1-" + i);
b[j].addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e )
{
int k = Integer.parseInt(
e.getActionCommand().substring(2));
for(int x = 0; x < k; x++)
{
cb[x].setState(
!cb[x].getState());
f.setVisible(true);
}
}
});
p2.add(b[j]);
}
Button b1 = new Button("More");
Button b2 = new Button("Save");
b1.addActionListener(l);
b2.addActionListener(l);
p2.add(b1);
p2.add(b2);
f.add("South", p2);
f.add("Center", p1);
f.add("North", t);
f.addWindowListener(
new WindowAdapter() {
public void windowClosing( WindowEvent e )
{
System.exit( 0 );
}
}
);
f.setVisible(true);
}
public static void main (String[] args)
{
new Configure();
}
String EnumMessage = "gnu.io.rxtx.properties has not been detected.\n\nThere is no consistant means of detecting ports on this operating System. It is necessary to indicate which ports are valid on this system before proper port enumeration can happen. Please check the ports that are valid on this system and select Save";
}
| 7,168
|
Java
|
.java
| 207
| 31.68599
| 326
| 0.68831
|
riedlse/RXTXcomm
| 5
| 5
| 1
|
LGPL-2.1
|
9/4/2024, 10:34:26 PM (Europe/Amsterdam)
| true
| true
| true
| true
| true
| true
| true
| true
| 7,168
|
2,924,718
|
AutoBoxingTest.java
|
maxeler_eclipse/eclipse.jdt.core/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java
|
/*******************************************************************************
* Copyright (c) 2005, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
import java.io.File;
import java.util.Map;
import junit.framework.Test;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
public class AutoBoxingTest extends AbstractComparableTest {
public AutoBoxingTest(String name) {
super(name);
}
protected Map getCompilerOptions() {
Map defaultOptions = super.getCompilerOptions();
defaultOptions.put(CompilerOptions.OPTION_ReportAutoboxing, CompilerOptions.WARNING);
return defaultOptions;
}
// Static initializer to specify tests subset using TESTS_* static variables
// All specified tests which does not belong to the class are skipped...
static {
// TESTS_NAMES = new String[] { "test000" };
// TESTS_NUMBERS = new int[] { 78 };
// TESTS_RANGE = new int[] { 151, -1 };
}
public static Test suite() {
return buildComparableTestSuite(testClass());
}
public static Class testClass() {
return AutoBoxingTest.class;
}
public void test001() { // constant cases of base type -> Number
// int -> Integer
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(1);\n" +
" }\n" +
" public static void test(Integer i) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// byte -> Byte
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test((byte)127);\n" +
" }\n" +
" public static void test(Byte b) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// char -> Character
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test('b');\n" +
" }\n" +
" public static void test(Character c) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// float -> Float
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(-0.0f);\n" +
" }\n" +
" public static void test(Float f) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// double -> Double
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(0.0);\n" +
" }\n" +
" public static void test(Double d) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// long -> Long
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(Long.MAX_VALUE);\n" +
" }\n" +
" public static void test(Long l) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// short -> Short
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(Short.MAX_VALUE);\n" +
" }\n" +
" public static void test(Short s) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// boolean -> Boolean
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(false);\n" +
" }\n" +
" public static void test(Boolean b) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
}
public void test002() { // non constant cases of base type -> Number
// int -> Integer
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static int bar() {return 1;}\n" +
" public static void main(String[] s) {\n" +
" test(bar());\n" +
" }\n" +
" public static void test(Integer i) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// byte -> Byte
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static byte bar() {return 1;}\n" +
" public static void main(String[] s) {\n" +
" test(bar());\n" +
" }\n" +
" public static void test(Byte b) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// char -> Character
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static char bar() {return 'c';}\n" +
" public static void main(String[] s) {\n" +
" test(bar());\n" +
" }\n" +
" public static void test(Character c) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// float -> Float
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static float bar() {return 0.0f;}\n" +
" public static void main(String[] s) {\n" +
" test(bar());\n" +
" }\n" +
" public static void test(Float f) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// double -> Double
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static double bar() {return 0.0;}\n" +
" public static void main(String[] s) {\n" +
" test(bar());\n" +
" }\n" +
" public static void test(Double d) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// long -> Long
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static long bar() {return 0;}\n" +
" public static void main(String[] s) {\n" +
" test(bar());\n" +
" }\n" +
" public static void test(Long l) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// short -> Short
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static short bar() {return 0;}\n" +
" public static void main(String[] s) {\n" +
" test(bar());\n" +
" }\n" +
" public static void test(Short s) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// boolean -> Boolean
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static boolean bar() {return true;}\n" +
" public static void main(String[] s) {\n" +
" test(bar());\n" +
" }\n" +
" public static void test(Boolean b) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
}
public void test003() { // Number -> base type
// Integer -> int
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(new Integer(1));\n" +
" }\n" +
" public static void test(int i) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// Byte -> byte
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(new Byte((byte) 1));\n" +
" }\n" +
" public static void test(byte b) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// Byte -> long
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(new Byte((byte) 1));\n" +
" }\n" +
" public static void test(long l) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// Character -> char
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(new Character('c'));\n" +
" }\n" +
" public static void test(char c) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// Float -> float
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(new Float(0.0f));\n" +
" }\n" +
" public static void test(float f) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// Double -> double
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(new Double(0.0));\n" +
" }\n" +
" public static void test(double d) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// Long -> long
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(new Long(0L));\n" +
" }\n" +
" public static void test(long l) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// Short -> short
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(new Short((short) 0));\n" +
" }\n" +
" public static void test(short s) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
// Boolean -> boolean
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" test(Boolean.TRUE);\n" +
" }\n" +
" public static void test(boolean b) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
}
public void test004() { // autoboxing method is chosen over private exact match & visible varargs method
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" Y.test(1);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" private static void test(int i) { System.out.print('n'); }\n" +
" static void test(int... i) { System.out.print('n'); }\n" +
" public static void test(Integer i) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" new Y().test(1);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" private void test(int i) { System.out.print('n'); }\n" +
" void test(int... i) { System.out.print('n'); }\n" +
" public void test(Integer i) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
}
public void test005() { // this is NOT an ambiguous case as 'long' is matched before autoboxing kicks in
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" new Y().test(1);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" void test(Integer i) { System.out.print('n'); }\n" +
" void test(long i) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
}
public void test006() {
this.runNegativeTest( // Integers are not compatible with Longs, even though ints are compatible with longs
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" new Y().test(1, 1);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" void test(Long i, int j) { System.out.print('n'); }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" new Y().test(1, 1);\n" +
" ^^^^\n" +
"The method test(Long, int) in the type Y is not applicable for the arguments (int, int)\n" +
"----------\n"
// test(java.lang.Long,int) in Y cannot be applied to (int,int)
);
this.runNegativeTest( // likewise with Byte and Integer
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" new Y().test((byte) 1, 1);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" void test(Integer i, int j) { System.out.print('n'); }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" new Y().test((byte) 1, 1);\n" +
" ^^^^\n" +
"The method test(Integer, int) in the type Y is not applicable for the arguments (byte, int)\n" +
"----------\n"
// test(java.lang.Integer,int) in Y cannot be applied to (byte,int)
);
}
public void test007() {
this.runConformTest( // this is NOT an ambiguous case as Long is not a match for int
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" new Y().test(1, 1);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" void test(Long i, int j) { System.out.print('n'); }\n" +
" void test(long i, Integer j) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
}
public void test008() { // test autoboxing AND varargs method match
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" Y.test(1, new Integer(2), -3);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public static void test(int ... i) { System.out.print('y'); }\n" +
"}\n",
},
"y"
);
}
public void test009() {
this.runNegativeTest( // 2 of these sends are ambiguous
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" new Y().test(1, 1);\n" + // reference to test is ambiguous, both method test(java.lang.Integer,int) in Y and method test(int,java.lang.Integer) in Y match
" new Y().test(new Integer(1), new Integer(1));\n" + // reference to test is ambiguous
" }\n" +
"}\n" +
"class Y {\n" +
" void test(Integer i, int j) {}\n" +
" void test(int i, Integer j) {}\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" new Y().test(1, 1);\n" +
" ^^^^\n" +
"The method test(Integer, int) is ambiguous for the type Y\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
" new Y().test(new Integer(1), new Integer(1));\n" +
" ^^^^\n" +
"The method test(Integer, int) is ambiguous for the type Y\n" +
"----------\n"
);
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" new Y().test(new Integer(1), 1);\n" +
" new Y().test(1, new Integer(1));\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" void test(Integer i, int j) { System.out.print(1); }\n" +
" void test(int i, Integer j) { System.out.print(2); }\n" +
"}\n",
},
"12"
);
}
public void test010() { // local declaration assignment tests
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" int i = Y.test();\n" +
" System.out.print(i);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public static Byte test() { return new Byte((byte) 1); }\n" +
"}\n",
},
"1"
);
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" Object o = Y.test();\n" +
" System.out.print(o);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public static int test() { return 1; }\n" +
"}\n",
},
"1"
);
}
public void test011() { // field declaration assignment tests
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" static int i = Y.test();\n" +
" public static void main(String[] s) {\n" +
" System.out.print(i);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public static Byte test() { return new Byte((byte) 1); }\n" +
"}\n",
},
"1"
);
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" static Object o = Y.test();\n" +
" public static void main(String[] s) {\n" +
" System.out.print(o);\n" +
" }\n" +
"}\n" +
"class Y {\n" +
" public static int test() { return 1; }\n" +
"}\n",
},
"1"
);
}
public void test012() { // varargs and autoboxing
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer x = new Integer(15); \n" +
" int y = 32;\n" +
" System.out.printf(\"%x + %x\", x, y);\n" +
" }\n" +
"}",
},
"f + 20"
);
}
public void test013() { // foreach and autoboxing
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" int[] tab = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };\n" +
" for (final Integer e : tab) {\n" +
" System.out.print(e);\n" +
" }\n" +
" }\n" +
"}\n",
},
"123456789"
);
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer[] tab = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };\n" +
" for (final int e : tab) {\n" +
" System.out.print(e);\n" +
" }\n" +
" }\n" +
"}\n",
},
"123456789"
);
}
public void test014() { // switch
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" Integer i = new Integer(1);\n" +
" switch(i) {\n" +
" case 1 : System.out.print('y');\n" +
" }\n" +
" }\n" +
"}\n",
},
"y"
);
}
public void test015() { // return statement
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" static Integer foo1() {\n" +
" return 0;\n" +
" }\n" +
" static int foo2() {\n" +
" return new Integer(0);\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" System.out.print(foo1());\n" +
" System.out.println(foo2());\n" +
" }\n" +
"}\n",
},
"00"
);
}
public void test016() { // conditional expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer i = args.length == 0 ? 0 : new Integer(1);\n" +
" System.out.println(i);\n" +
" }\n" +
"}\n",
},
"0"
);
}
public void test017() { // cast expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer i = new Integer(1);\n" +
" System.out.println((int)i);\n" +
" }\n" +
"}\n",
},
"1"
);
}
public void test018() { // cast expression
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Float f = args.length == 0 ? new Float(0) : 0;\n" +
" System.out.println((int)f);\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Float f = args.length == 0 ? new Float(0) : 0;\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"The expression of type float is boxed into Float\n" +
"----------\n" +
"2. WARNING in X.java (at line 3)\n" +
" Float f = args.length == 0 ? new Float(0) : 0;\n" +
" ^^^^^^^^^^^^\n" +
"The expression of type Float is unboxed into float\n" +
"----------\n" +
"3. ERROR in X.java (at line 4)\n" +
" System.out.println((int)f);\n" +
" ^^^^^^\n" +
"Cannot cast from Float to int\n" +
"----------\n");
}
public void test019() { // cast expression
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" System.out.println((Integer) 0);\n" +
" System.out.println((Float) 0);\n" +
" \n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" System.out.println((Integer) 0);\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
" System.out.println((Float) 0);\n" +
" ^^^^^^^^^\n" +
"Cannot cast from int to Float\n" +
"----------\n");
}
public void test020() { // binary expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Byte b = new Byte((byte)1);\n" +
" System.out.println(2 + b);\n" +
" }\n" +
"}\n",
},
"3"
);
}
public void test021() { // unary expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Byte b = new Byte((byte)1);\n" +
" Integer i = +b + (-b);\n" +
" System.out.println(i);\n" +
" }\n" +
"}\n",
},
"0"
);
}
public void test022() { // unary expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Byte b = new Byte((byte)1);\n" +
" Integer i = 0;\n" +
" int n = b + i;\n" +
" System.out.println(n);\n" +
" }\n" +
"}\n",
},
"1"
);
}
public void test023() { // 78849
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Character cValue = new Character('c');\n" +
" if ('c' == cValue) System.out.println('y');\n" +
" }\n" +
"}\n",
},
"y"
);
}
public void test024() { // 79254
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) { test(2); }\n" +
" static void test(Object o) { System.out.println('y'); }\n" +
"}\n",
},
"y"
);
}
public void test025() { // 79641
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) { test(true); }\n" +
" static void test(Object ... o) { System.out.println('y'); }\n" +
"}\n",
},
"y"
);
}
public void test026() { // compound assignment
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Byte b = new Byte((byte)1);\n" +
" Integer i = 0;\n" +
" i += b;\n" +
" System.out.println(i);\n" +
" }\n" +
"}\n",
},
"1"
);
}
public void test027() { // equal expression
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" if (0 == new X()) {\n" +
" System.out.println();\n" +
" }\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" if (0 == new X()) {\n" +
" ^^^^^^^^^^^^\n" +
"Incompatible operand types int and X\n" +
"----------\n"
);
}
public void test028() { // unary expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Byte b = new Byte((byte)1);\n" +
" int i = +b;\n" +
" System.out.println(i);\n" +
" }\n" +
"}\n",
},
"1"
);
}
public void test029() { // generic type case
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"import java.util.Iterator;\n" +
"\n" +
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" List<Integer> list = new ArrayList<Integer>();\n" +
" for (int i = 0; i < 5; i++) {\n" +
" list.add(i);\n" +
" }\n" +
" int sum = 0;\n" +
" for (Iterator<Integer> iterator = list.iterator(); iterator.hasNext(); ) {\n" +
" sum += iterator.next();\n" +
" }\n" +
" System.out.print(sum);\n" +
" }\n" +
"}",
},
"10"
);
}
public void test030() { // boolean expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Boolean b = Boolean.TRUE;\n" +
" \n" +
" if (b && !b) {\n" +
" System.out.print(\"THEN\");\n" +
" } else {\n" +
" System.out.print(\"ELSE\");\n" +
" }\n" +
" }\n" +
"}",
},
"ELSE"
);
}
public void test031() { // boolean expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static Boolean foo() { return Boolean.FALSE; }\n" +
" public static void main(String[] args) {\n" +
" Boolean b = foo();\n" +
" \n" +
" if (!b) {\n" +
" System.out.print(\"THEN\");\n" +
" } else {\n" +
" System.out.print(\"ELSE\");\n" +
" }\n" +
" }\n" +
"}",
},
"THEN"
);
}
public void test032() throws Exception { // boolean expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" if (new Integer(1) == new Integer(0)) {\n" +
" System.out.println();\n" +
" }\n" +
" System.out.print(\"SUCCESS\");\n" +
" }\n" +
"}",
},
"SUCCESS"
);
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator +"X.class"));
String actualOutput =
disassembler.disassemble(
classFileBytes,
"\n",
ClassFileBytesDisassembler.DETAILED);
String expectedOutput =
" // Method descriptor #15 ([Ljava/lang/String;)V\n" +
" // Stack: 4, Locals: 1\n" +
" public static void main(java.lang.String[] args);\n" +
" 0 new java.lang.Integer [16]\n" +
" 3 dup\n" +
" 4 iconst_1\n" +
" 5 invokespecial java.lang.Integer(int) [18]\n" +
" 8 new java.lang.Integer [16]\n" +
" 11 dup\n" +
" 12 iconst_0\n" +
" 13 invokespecial java.lang.Integer(int) [18]\n" +
" 16 if_acmpne 25\n" +
" 19 getstatic java.lang.System.out : java.io.PrintStream [21]\n" +
" 22 invokevirtual java.io.PrintStream.println() : void [27]\n" +
" 25 getstatic java.lang.System.out : java.io.PrintStream [21]\n" +
" 28 ldc <String \"SUCCESS\"> [32]\n" +
" 30 invokevirtual java.io.PrintStream.print(java.lang.String) : void [34]\n" +
" 33 return\n";
int index = actualOutput.indexOf(expectedOutput);
if (index == -1 || expectedOutput.length() == 0) {
System.out.println(Util.displayString(actualOutput, 3));
}
if (index == -1) {
assertEquals("Wrong contents", expectedOutput, actualOutput);
}
}
public void test033() { // boolean expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" System.out.print(Boolean.TRUE || Boolean.FALSE);\n" +
" }\n" +
"}",
},
"true"
);
}
public void test034() { // postfix expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Byte b = new Byte((byte)1);\n" +
" int i = b++;\n" +
" System.out.print(i);\n" +
" System.out.print(b);\n" +
" }\n" +
"}\n",
},
"12"
);
}
public void test035() { // postfix expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Byte b = new Byte((byte)1);\n" +
" int i = b--;\n" +
" System.out.print(i);\n" +
" System.out.print(b);\n" +
" }\n" +
"}\n",
},
"10"
);
}
public void test036() { // prefix expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Byte b = new Byte((byte)1);\n" +
" int i = ++b;\n" +
" System.out.print(i);\n" +
" System.out.print(b);\n" +
" }\n" +
"}\n",
},
"22"
);
}
public void test037() { // prefix expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Byte b = new Byte((byte)1);\n" +
" int i = --b;\n" +
" System.out.print(i);\n" +
" System.out.print(b);\n" +
" }\n" +
"}\n",
},
"00"
);
}
public void test038() { // boolean expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static boolean foo() { return false; }\n" +
" public static void main(String[] s) {\n" +
" boolean b = foo();\n" +
" System.out.print(b || Boolean.FALSE);\n" +
" }\n" +
"}",
},
"false"
);
}
public void test039() { // equal expression
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" int i = 0;\n" +
" if (i != null) {\n" +
" }\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
" if (i != null) {\n" +
" ^^^^^^^^^\n" +
"The operator != is undefined for the argument type(s) int, null\n" +
"----------\n"
);
}
public void test040() { // boolean expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Integer i = new Integer(1);\n" +
" if (i == null)\n" +
" i++;\n" +
" System.out.print(i);\n" +
" }\n" +
"}",
},
"1"
);
}
public void test041() { // equal expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer i = 0;\n" +
" if (i != null) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS"
);
}
public void test042() { // conditional expression
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static Boolean bar() { return Boolean.TRUE; } \n" +
" public static void main(String[] args) {\n" +
" Integer i = bar() ? new Integer(1) : null;\n" +
" int j = i;\n" +
" System.out.print(j);\n" +
" }\n" +
"}",
},
"1"
);
}
public void test043() { // compound assignment
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer i = 0;\n" +
" i += \"aaa\";\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Integer i = 0;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
" i += \"aaa\";\n" +
" ^^^^^^^^^^\n" +
"The operator += is undefined for the argument type(s) Integer, String\n" +
"----------\n");
}
public void test044() { // compound assignment
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer i = 0;\n" +
" i += null;\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Integer i = 0;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
" i += null;\n" +
" ^^^^^^^^^\n" +
"The operator += is undefined for the argument type(s) Integer, null\n" +
"----------\n");
}
public void test045() { // binary expression
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer i = 0;\n" +
" i = i + null;\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Integer i = 0;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
" i = i + null;\n" +
" ^^^^^^^^\n" +
"The operator + is undefined for the argument type(s) Integer, null\n" +
"----------\n");
}
public void test046() { // postfix increment
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" Byte b = new Byte((byte)1);\n" +
" b++;\n" +
" System.out.println((Byte)b);\n" +
" }\n" +
"}\n",
},
"2");
}
public void test047() { // postfix increment
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" Byte b = new Byte((byte)1);\n" +
" b++;\n" +
" if (b instanceof Byte) {\n" +
" System.out.println(\"SUCCESS\" + b);\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS2");
}
public void test048() { // postfix increment
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static Byte b = new Byte((byte)1);\n" +
" public static void main(String[] s) {\n" +
" b++;\n" +
" if (b instanceof Byte) {\n" +
" System.out.print(\"SUCCESS\" + b);\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS2");
}
public void test049() { // postfix increment
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static class Y {\n" +
" public static Byte b = new Byte((byte)1);\n" +
" }\n" +
" public static void main(String[] s) {\n" +
" X.Y.b++;\n" +
" if (X.Y.b instanceof Byte) {\n" +
" System.out.print(\"SUCCESS\" + X.Y.b);\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS2");
}
public void test050() { // prefix increment
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static Byte b = new Byte((byte)1);\n" +
" public static void main(String[] s) {\n" +
" ++b;\n" +
" if (b instanceof Byte) {\n" +
" System.out.print(\"SUCCESS\" + b);\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS2");
}
public void test051() { // prefix increment
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static class Y {\n" +
" public static Byte b = new Byte((byte)1);\n" +
" }\n" +
" public static void main(String[] s) {\n" +
" ++X.Y.b;\n" +
" if (X.Y.b instanceof Byte) {\n" +
" System.out.print(\"SUCCESS\" + X.Y.b);\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS2");
}
public void test052() { // boxing in var decl
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" Byte b = 0;\n" +
" ++b;\n" +
" foo(0);\n" +
" }\n" +
" static void foo(Byte b) {\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Byte b = 0;\n" +
" ^\n" +
"The expression of type int is boxed into Byte\n" +
"----------\n" +
"2. WARNING in X.java (at line 4)\n" +
" ++b;\n" +
" ^^^\n" +
"The expression of type byte is boxed into Byte\n" +
"----------\n" +
"3. WARNING in X.java (at line 4)\n" +
" ++b;\n" +
" ^\n" +
"The expression of type Byte is unboxed into int\n" +
"----------\n" +
"4. ERROR in X.java (at line 5)\n" +
" foo(0);\n" +
" ^^^\n" +
"The method foo(Byte) in the type X is not applicable for the arguments (int)\n" +
"----------\n");
}
public void test053() { // boxing in var decl
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" Byte b = 1;\n" +
" ++b;\n" +
" if (b instanceof Byte) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS");
}
public void test054() { // boxing in field decl
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" static Byte b = 1;\n" +
" public static void main(String[] s) {\n" +
" ++b;\n" +
" if (b instanceof Byte) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS");
}
public void test055() { // boxing in foreach
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" byte[] bytes = {0, 1, 2};\n" +
" for(Integer i : bytes) {\n" +
" System.out.print(i);\n" +
" }\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
" for(Integer i : bytes) {\n" +
" ^^^^^\n" +
"Type mismatch: cannot convert from element type byte to Integer\n" +
"----------\n" +
"2. WARNING in X.java (at line 4)\n" +
" for(Integer i : bytes) {\n" +
" ^^^^^\n" +
"The expression of type byte is boxed into Integer\n" +
"----------\n");
}
public void test056() { // boxing in foreach
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" int[] ints = {0, 1, 2};\n" +
" for(Integer i : ints) {\n" +
" System.out.print(i);\n" +
" }\n" +
" }\n" +
"}\n",
},
"012");
}
public void test057() { // boxing in foreach
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" byte[] bytes = {0, 1, 2};\n" +
" for(Byte b : bytes) {\n" +
" System.out.print(b);\n" +
" }\n" +
" }\n" +
"}\n",
},
"012");
}
public void test058() { // autoboxing and generics
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"import java.util.Iterator;\n" +
"\n" +
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" List<Integer> list = new ArrayList<Integer>();\n" +
" for (int i = 0; i < 5; i++) {\n" +
" list.add(i);\n" +
" }\n" +
" int sum = 0;\n" +
" for (Integer i : list) {\n" +
" sum += i;\n" +
" } \n" +
" System.out.print(sum);\n" +
" }\n" +
"}\n",
},
"10");
}
public void test059() { // autoboxing and generics
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"import java.util.Iterator;\n" +
"\n" +
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" List<Integer> list = new ArrayList<Integer>();\n" +
" for (int i = 0; i < 5; i++) {\n" +
" list.add(i);\n" +
" }\n" +
" int sum = 0;\n" +
" for (Iterator<Integer> iterator = list.iterator(); iterator.hasNext(); ) {\n" +
" if (1 == iterator.next()) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" break;\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS");
}
public void test060() { // autoboxing and boolean expr
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"import java.util.Iterator;\n" +
"\n" +
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" List<Boolean> list = new ArrayList<Boolean>();\n" +
" for (int i = 0; i < 5; i++) {\n" +
" list.add(i % 2 == 0);\n" +
" }\n" +
" for (Iterator<Boolean> iterator = list.iterator(); iterator.hasNext(); ) {\n" +
" if (iterator.next()) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" break;\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS");
}
public void test061() { // autoboxing and boolean expr
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"import java.util.Iterator;\n" +
"\n" +
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" List<Boolean> list = new ArrayList<Boolean>();\n" +
" boolean b = true;\n" +
" for (int i = 0; i < 5; i++) {\n" +
" list.add((i % 2 == 0) && b);\n" +
" }\n" +
" for (Iterator<Boolean> iterator = list.iterator(); iterator.hasNext(); ) {\n" +
" if (iterator.next()) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" break;\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS");
}
public void test062() { // autoboxing and generics
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"import java.util.Iterator;\n" +
"\n" +
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" List<Integer> list = new ArrayList<Integer>();\n" +
" boolean b = true;\n" +
" for (int i = 0; i < 5; i++) {\n" +
" list.add(i);\n" +
" }\n" +
" int sum = 0;\n" +
" for (Iterator<Integer> iterator = list.iterator(); iterator.hasNext(); ) {\n" +
" sum = sum + iterator.next();\n" +
" }\n" +
" System.out.println(sum);\n" +
" }\n" +
"}\n",
},
"10");
}
public void test063() { // autoboxing and generics
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"import java.util.Iterator;\n" +
"\n" +
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" List<Integer> list = new ArrayList<Integer>();\n" +
" boolean b = true;\n" +
" for (int i = 0; i < 5; i++) {\n" +
" list.add(i);\n" +
" }\n" +
" int val = 0;\n" +
" for (Iterator<Integer> iterator = list.iterator(); iterator.hasNext(); ) {\n" +
" val = ~ iterator.next();\n" +
" }\n" +
" System.out.println(val);\n" +
" }\n" +
"}\n",
},
"-5");
}
public void test064() { // autoboxing and generics
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"import java.util.Iterator;\n" +
"\n" +
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" List<Integer> list = new ArrayList<Integer>();\n" +
" boolean b = true;\n" +
" for (int i = 0; i < 5; i++) {\n" +
" list.add(i);\n" +
" }\n" +
" int val = 0;\n" +
" for (Iterator<Integer> iterator = list.iterator(); iterator.hasNext(); ) {\n" +
" val += (int) iterator.next();\n" +
" }\n" +
" System.out.println(val);\n" +
" }\n" +
"}\n",
},
"10");
}
public void test065() { // generic type case + foreach statement
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" List<Integer> list = new ArrayList<Integer>();\n" +
" for (int i = 0; i < 5; i++) {\n" +
" list.add(i);\n" +
" }\n" +
" int sum = 0;\n" +
" for (int i : list) {\n" +
" sum += i;\n" +
" }\n" +
" System.out.print(sum);\n" +
" }\n" +
"}",
},
"10"
);
}
public void test066() { // array case + foreach statement
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer[] tab = new Integer[] {0, 1, 2, 3, 4};\n" +
" int sum = 0;\n" +
" for (int i : tab) {\n" +
" sum += i;\n" +
" }\n" +
" System.out.print(sum);\n" +
" }\n" +
"}",
},
"10"
);
}
public void test067() { // array case + foreach statement
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" int[] tab = new int[] {0, 1, 2, 3, 4};\n" +
" int sum = 0;\n" +
" for (Integer i : tab) {\n" +
" sum += i;\n" +
" }\n" +
" System.out.print(sum);\n" +
" }\n" +
"}",
},
"10"
);
}
public void test068() { // generic type case + foreach statement
this.runConformTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" List<Integer> list = new ArrayList<Integer>();\n" +
" for (int i = 0; i < 5; i++) {\n" +
" list.add(i);\n" +
" }\n" +
" int sum = 0;\n" +
" for (Integer i : list) {\n" +
" sum += i;\n" +
" }\n" +
" System.out.print(sum);\n" +
" }\n" +
"}",
},
"10"
);
}
public void test069() { // assert
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Boolean bool = true;\n" +
" assert bool : \"failed\";\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}\n",
},
"SUCCESS");
}
public void test070() { // assert
this.runConformTest(
new String[] {
"X.java",
"import java.util.*;\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" List<Boolean> lb = new ArrayList<Boolean>();\n" +
" lb.add(true);\n" +
" Iterator<Boolean> iterator = lb.iterator();\n" +
" assert iterator.next() : \"failed\";\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}\n",
},
"SUCCESS");
}
public void test071() { // assert
this.runConformTest(
new String[] {
"X.java",
"import java.util.*;\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" List<Boolean> lb = new ArrayList<Boolean>();\n" +
" lb.add(true);\n" +
" Iterator<Boolean> iterator = lb.iterator();\n" +
" assert args != null : iterator.next();\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}\n",
},
"SUCCESS");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81971
public void test072() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" doFoo(getVoid());\n" +
" }\n" +
"\n" +
" private static void doFoo(Object o) { }\n" +
"\n" +
" private static void getVoid() { }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" doFoo(getVoid());\n" +
" ^^^^^\n" +
"The method doFoo(Object) in the type X is not applicable for the arguments (void)\n" +
"----------\n");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81571
public void test073() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" a(new Integer(1), 2);\n" +
" }\n" +
" public static void a(int a, int b) { System.out.println(\"SUCCESS\"); }\n" +
" public static void a(Object a, Object b) {}\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" a(new Integer(1), 2);\n" +
" ^\n" +
"The method a(int, int) is ambiguous for the type X\n" +
"----------\n"
// a is ambiguous, both method a(int,int) in X and method a(java.lang.Object,java.lang.Object) in X match
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82432
public void test074() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" Object e() {\n" +
" return \"\".compareTo(\"\") > 0;\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" System.out.print(new X().e());\n" +
" }\n" +
"}",
},
"false");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82432 - variation
public void test075() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" Object e() {\n" +
" return \"\".compareTo(\"\") > 0;\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" System.out.print(new X().e());\n" +
" }\n" +
" Zork z;\n" +
"}",
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" return \"\".compareTo(\"\") > 0;\n" +
" ^^^^^^^^^^^^^^^^^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"2. ERROR in X.java (at line 8)\n" +
" Zork z;\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82432 - variation
public void test076() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" Object e() {\n" +
" int i = 12; \n" +
" boolean b = false;\n" +
" switch(i) {\n" +
" case 0: return i > 0;\n" +
" case 1: return i >= 0;\n" +
" case 2: return i < 0;\n" +
" case 3: return i <= 0;\n" +
" case 4: return i == 0;\n" +
" case 5: return i != 0;\n" +
" case 6: return i & 0;\n" +
" case 7: return i ^ 0;\n" +
" case 8: return i | 0;\n" +
" case 9: return b && b;\n" +
" default: return b || b;\n" +
" }\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" System.out.print(new X().e());\n" +
" }\n" +
" Zork z;\n" +
"}",
},
"----------\n" +
"1. WARNING in X.java (at line 6)\n" +
" case 0: return i > 0;\n" +
" ^^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"2. WARNING in X.java (at line 7)\n" +
" case 1: return i >= 0;\n" +
" ^^^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"3. WARNING in X.java (at line 8)\n" +
" case 2: return i < 0;\n" +
" ^^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"4. WARNING in X.java (at line 9)\n" +
" case 3: return i <= 0;\n" +
" ^^^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"5. WARNING in X.java (at line 10)\n" +
" case 4: return i == 0;\n" +
" ^^^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"6. WARNING in X.java (at line 11)\n" +
" case 5: return i != 0;\n" +
" ^^^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"7. WARNING in X.java (at line 12)\n" +
" case 6: return i & 0;\n" +
" ^^^^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"8. WARNING in X.java (at line 13)\n" +
" case 7: return i ^ 0;\n" +
" ^^^^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"9. WARNING in X.java (at line 14)\n" +
" case 8: return i | 0;\n" +
" ^^^^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"10. WARNING in X.java (at line 15)\n" +
" case 9: return b && b;\n" +
" ^^^^^^\n" +
"Comparing identical expressions\n" +
"----------\n" +
"11. WARNING in X.java (at line 15)\n" +
" case 9: return b && b;\n" +
" ^^^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"12. WARNING in X.java (at line 16)\n" +
" default: return b || b;\n" +
" ^^^^^^\n" +
"Comparing identical expressions\n" +
"----------\n" +
"13. WARNING in X.java (at line 16)\n" +
" default: return b || b;\n" +
" ^^^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"14. ERROR in X.java (at line 22)\n" +
" Zork z;\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82432 - variation
public void test077() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" Object e() {\n" +
" int i = 12; \n" +
" boolean b = false;\n" +
" switch(i) {\n" +
" case 0: return i > 0;\n" +
" case 1: return i >= 0;\n" +
" case 2: return i < 0;\n" +
" case 3: return i <= 0;\n" +
" case 4: return i == 0;\n" +
" case 5: return i != 0;\n" +
" case 6: return i & 0;\n" +
" case 7: return i ^ 0;\n" +
" case 8: return i | 0;\n" +
" case 9: return b && b;\n" +
" default: return b || b;\n" +
" }\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" System.out.print(new X().e());\n" +
" }\n" +
"}",
},
"false");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81923
public void test078() {
this.runConformTest(
new String[] {
"X.java",
"public class X<T> {\n" +
" public <A extends T> X(A... t) {}\n" +
" <T> void foo(T... t) {}\n" +
" <T> void zip(T t) {}\n" +
" void test() {\n" +
" new X<Integer>(10, 20);\n" +
" foo(10);\n" +
" foo(10, 20);\n" +
" zip(10);\n" +
" }\n" +
"}\n"
},
""
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82407
public void _test079() {
this.runConformTest(
new String[] {
"X.java",
"import java.util.HashMap;\n" +
"public class X {\n" +
" static HashMap<Character, Character> substitutionList(String s1, String s2) {\n" +
" HashMap<Character, Character> subst = new HashMap<Character, Character>();\n" +
" for (int i = 0; i < s1.length(); i++) {\n" +
" char key = s1.charAt(i);\n" +
" char value = s2.charAt(i);\n" +
" if (subst.containsKey(key)) {\n" +
" if (value != subst.get(key)) {\n" +
" return null;\n" +
" }\n" +
" } else if (subst.containsValue(value)) {\n" +
" return null;\n" +
" } else {\n" +
" subst.put(key, value);\n" +
" }\n" +
" }\n" +
" return subst;\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" System.out.println(\"Bogon\");\n" +
" }\n" +
"}\n"
},
"SUCCESS");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82407 - variation
public void test080() {
this.runConformTest(
new String[] {
"X.java",
"import java.util.HashMap;\n" +
"\n" +
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" HashMap<Character, Character> subst = new HashMap<Character, Character>();\n" +
" subst.put(\'a\', \'a\');\n" +
" if (\'a\' == subst.get(\'a\')) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}\n"
},
"SUCCESS");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82407 - variation
public void test081() {
this.runConformTest(
new String[] {
"X.java",
"import java.util.HashMap;\n" +
"\n" +
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" HashMap<Byte, Byte> subst = new HashMap<Byte, Byte>();\n" +
" subst.put((byte)1, (byte)1);\n" +
" if (1 + subst.get((byte)1) > 0.f) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" } \n" +
" }\n" +
"}\n"
},
"SUCCESS");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82859
public void test082() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String argv[]) {\n" +
" System.out.println(void.class == Void.TYPE);\n" +
" }\n" +
"}"
},
"true"
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82647
public void test083() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" int counter = 0;\n" +
"\n" +
" public boolean wasNull() {\n" +
" return ++counter % 2 == 0;\n" +
" }\n" +
"\n" +
" private Byte getByte() {\n" +
" return (byte) 0;\n" +
" }\n" +
"\n" +
" private Short getShort() {\n" +
" return (short) 0;\n" +
" }\n" +
"\n" +
" private Long getLong() {\n" +
" return 0L;\n" +
" }\n" +
"\n" +
" private Integer getInt() {\n" +
" return 0; // autoboxed okay\n" +
" }\n" +
"\n" +
" // This should be the same as the second one.\n" +
" private Byte getBytey() {\n" +
" byte value = getByte();\n" +
" return wasNull() ? null : value;\n" +
" }\n" +
"\n" +
" private Byte getByteyNoBoxing() {\n" +
" byte value = getByte();\n" +
" return wasNull() ? null : (Byte) value;\n" +
" }\n" +
"\n" +
" // This should be the same as the second one.\n" +
" private Short getShorty() {\n" +
" short value = getShort();\n" +
" return wasNull() ? null : value;\n" +
" }\n" +
"\n" +
" private Short getShortyNoBoxing() {\n" +
" short value = getShort();\n" +
" return wasNull() ? null : (Short) value;\n" +
" }\n" +
"\n" +
" // This should be the same as the second one.\n" +
" private Long getLongy() {\n" +
" long value = getLong();\n" +
" return wasNull() ? null : value;\n" +
" }\n" +
"\n" +
" private Long getLongyNoBoxing() {\n" +
" long value = getLong();\n" +
" return wasNull() ? null : (Long) value;\n" +
" }\n" +
"\n" +
" // This should be the same as the second one.\n" +
" private Integer getIntegery() {\n" +
" int value = getInt();\n" +
" return wasNull() ? null : value;\n" +
" }\n" +
"\n" +
" private Integer getIntegeryNoBoxing() {\n" +
" int value = getInt();\n" +
" return wasNull() ? null : (Integer) value;\n" +
" }\n" +
"}\n"
},
""
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82647 - variation
public void test084() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" Short foo() {\n" +
" short value = 0;\n" +
" return this == null ? null : value;\n" +
" }\n" +
" boolean bar() {\n" +
" short value = 0;\n" +
" return null == value;\n" +
" }\n" +
"}\n"
},
"----------\n" +
"1. WARNING in X.java (at line 4)\n" +
" return this == null ? null : value;\n" +
" ^^^^^\n" +
"The expression of type short is boxed into Short\n" +
"----------\n" +
"2. ERROR in X.java (at line 8)\n" +
" return null == value;\n" +
" ^^^^^^^^^^^^^\n" +
"The operator == is undefined for the argument type(s) null, short\n" +
"----------\n"
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=83965
public void test085() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" private static void checkByteConversions(Byte _byte) {\n" +
" short s = (short) _byte;\n" +
" short s2 = _byte;\n" +
" int i = (int) _byte;\n" +
" long l = (long) _byte;\n" +
" float f = (float) _byte;\n" +
" double d = (double) _byte;\n" +
" if ( _byte.byteValue() != s ) {\n" +
" System.err.println(\"Must be equal 0\");\n" +
" }\n" +
" if ( _byte.byteValue() != i ) {\n" +
" System.err.println(\"Must be equal 1\");\n" +
" }\n" +
" if ( _byte.byteValue() != l ) {\n" +
" System.err.println(\"Must be equal 2\");\n" +
" }\n" +
" if ( _byte.byteValue() != f ) {\n" +
" System.err.println(\"Must be equal 3\");\n" +
" }\n" +
" if ( _byte.byteValue() != d ) {\n" +
" System.err.println(\"Must be equal 4\");\n" +
" }\n" +
" } \n" +
"\n" +
" private static void checkCharacterConversions(Character _character) {\n" +
" int i = (int) _character;\n" +
" long l = (long) _character;\n" +
" float f = (float) _character;\n" +
" double d = (double) _character;\n" +
" if ( _character.charValue() != i ) {\n" +
" System.err.println(\"Must be equal 9\");\n" +
" }\n" +
" if ( _character.charValue() != l ) {\n" +
" System.err.println(\"Must be equal 10\");\n" +
" }\n" +
" if ( _character.charValue() != f ) {\n" +
" System.err.println(\"Must be equal 11\");\n" +
" }\n" +
" if ( _character.charValue() != d ) {\n" +
" System.err.println(\"Must be equal 12\");\n" +
" }\n" +
" }\n" +
"\n" +
" private static void checkFloatConversions(Float _float) {\n" +
" double d = (double) _float;\n" +
" if ( _float.floatValue() != d ) {\n" +
" System.err.println(\"Must be equal 18\");\n" +
" }\n" +
" }\n" +
"\n" +
" private static void checkIntegerConversions(Integer _integer) {\n" +
" long l = (long) _integer;\n" +
" float f = (float) _integer;\n" +
" double d = (double) _integer;\n" +
" if ( _integer.intValue() != l ) {\n" +
" System.err.println(\"Must be equal 13\");\n" +
" }\n" +
" if ( _integer.intValue() != f ) {\n" +
" System.err.println(\"Must be equal 14\");\n" +
" }\n" +
" if ( _integer.intValue() != d ) {\n" +
" System.err.println(\"Must be equal 15\");\n" +
" }\n" +
" }\n" +
"\n" +
" private static void checkIntegerConversions(Short _short) {\n" +
" int i = (int) _short;\n" +
" long l = (long) _short;\n" +
" float f = (float) _short;\n" +
" double d = (double) _short;\n" +
" if ( _short.shortValue() != i ) {\n" +
" System.err.println(\"Must be equal 5\");\n" +
" }\n" +
" if ( _short.shortValue() != l ) {\n" +
" System.err.println(\"Must be equal 6\");\n" +
" }\n" +
" if ( _short.shortValue() != f ) {\n" +
" System.err.println(\"Must be equal 7\");\n" +
" }\n" +
" if ( _short.shortValue() != d ) {\n" +
" System.err.println(\"Must be equal 8\");\n" +
" }\n" +
" }\n" +
"\n" +
" private static void checkLongConversions(Long _long) {\n" +
" float f = (float) _long;\n" +
" double d = (double) _long;\n" +
" if ( _long.longValue() != f ) {\n" +
" System.err.println(\"Must be equal 16\");\n" +
" }\n" +
" if ( _long.longValue() != d ) {\n" +
" System.err.println(\"Must be equal 17\");\n" +
" }\n" +
" }\n" +
"\n" +
" public static void main(String args[]) {\n" +
" Byte _byte = new Byte((byte)2);\n" +
" Character _character = new Character(\'@\');\n" +
" Short _short = new Short((short)255);\n" +
" Integer _integer = new Integer(12345678);\n" +
" Long _long = new Long(1234567890);\n" +
" Float _float = new Float(-0.0);\n" +
"\n" +
" checkByteConversions(_byte);\n" +
" checkIntegerConversions(_short);\n" +
" checkCharacterConversions(_character);\n" +
" checkIntegerConversions(_integer);\n" +
" checkLongConversions(_long);\n" +
" checkFloatConversions(_float);\n" +
"\n" +
" System.out.println(\"OK\");\n" +
" }\n" +
"}\n"
},
"OK"
);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84055
public void test086() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" private static void checkConversions(byte _byte) {\n" +
" Short s = (short) _byte; // cast is necessary\n" +
" Short s2 = _byte; // ko\n" +
" } \n" +
" public static void main(String args[]) {\n" +
" byte _byte = 2;\n" +
" checkConversions(_byte);\n" +
" System.out.println(\"OK\");\n" +
" }\n" +
"}\n"
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Short s = (short) _byte; // cast is necessary\n" +
" ^^^^^^^^^^^^^\n" +
"The expression of type short is boxed into Short\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
" Short s2 = _byte; // ko\n" +
" ^^^^^\n" +
"Type mismatch: cannot convert from byte to Short\n" +
"----------\n"
);
}
// autoboxing and type argument inference
public void test087() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" <T> T foo(T t) { return t; }\n" +
" \n" +
" public static void main(String[] args) {\n" +
" int i = new X().foo(12);\n" +
" System.out.println(i);\n" +
" }\n" +
" Zork z;\n" +
"}\n"
},
"----------\n" +
"1. WARNING in X.java (at line 5)\n" +
" int i = new X().foo(12);\n" +
" ^^^^^^^^^^^^^^^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"2. WARNING in X.java (at line 5)\n" +
" int i = new X().foo(12);\n" +
" ^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"3. ERROR in X.java (at line 8)\n" +
" Zork z;\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n"
);
}
/*
* http://bugs.eclipse.org/bugs/show_bug.cgi?id=84480 - variation with autoboxing diagnosis on
*/
public void test088() {
Map customOptions = getCompilerOptions();
customOptions.put(CompilerOptions.OPTION_ReportAutoboxing, CompilerOptions.WARNING);
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" int f;\n" +
" void foo(int i) {\n" +
" i = i++;\n" +
" i = ++i;\n" +
" f = f++;\n" +
" f = ++f;\n" +
" Zork z;\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 5)\n" +
" i = ++i;\n" +
" ^^^^^^^\n" +
"The assignment to variable i has no effect\n" +
"----------\n" +
"2. WARNING in X.java (at line 7)\n" +
" f = ++f;\n" +
" ^^^^^^^\n" +
"The assignment to variable f has no effect\n" +
"----------\n" +
"3. ERROR in X.java (at line 8)\n" +
" Zork z;\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n",
null,
true,
customOptions);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84345
public void test089() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public Object foo() {\n" +
" byte b = 0;\n" +
" Number n = (Number) b;\n" +
"\n" +
" java.io.Serializable o = null;\n" +
" if (o == 0) return o;\n" +
" return this;\n" +
" }\n" +
"}\n"
},
"----------\n" +
"1. WARNING in X.java (at line 4)\n" +
" Number n = (Number) b;\n" +
" ^^^^^^^^^^\n" +
"Unnecessary cast from byte to Number\n" +
"----------\n" +
"2. WARNING in X.java (at line 4)\n" +
" Number n = (Number) b;\n" +
" ^\n" +
"The expression of type byte is boxed into Byte\n" +
"----------\n" +
"3. ERROR in X.java (at line 7)\n" +
" if (o == 0) return o;\n" +
" ^^^^^^\n" +
"Incompatible operand types Serializable and int\n" +
"----------\n"
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84345 - variation
public void test090() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public Object foo() {\n" +
" \n" +
" Boolean b = null;\n" +
" if (b == true) return b;\n" +
" Object o = null;\n" +
" if (o == true) return o;\n" +
" return this;\n" +
" }\n" +
"}\n"
},
"----------\n" +
"1. WARNING in X.java (at line 5)\n" +
" if (b == true) return b;\n" +
" ^\n" +
"The expression of type Boolean is unboxed into boolean\n" +
"----------\n" +
"2. ERROR in X.java (at line 7)\n" +
" if (o == true) return o;\n" +
" ^^^^^^^^^\n" +
"Incompatible operand types Object and boolean\n" +
"----------\n"
);
}
// type argument inference and autoboxing
public void test091() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Comparable<?> c1 = foo(\"\", new Integer(5));\n" +
" Object o = foo(\"\", 5);\n" +
" }\n" +
" public static <T> T foo(T t1, T t2) { \n" +
" System.out.print(\"foo(\"+t1.getClass().getSimpleName()+\",\"+t2.getClass().getSimpleName()+\")\");\n" +
" return null; \n" +
" }\n" +
"}\n"
},
"foo(String,Integer)foo(String,Integer)"
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84669
public void test092() {
this.runConformTest(
new String[] {
"X.java",
"public class X\n" +
"{\n" +
" public X()\n" +
" {\n" +
" super();\n" +
" }\n" +
"\n" +
" public Object convert(Object value)\n" +
" {\n" +
" Double d = (Double)value;\n" +
" d = (d/100);\n" +
" return d;\n" +
" }\n" +
"\n" +
" public static void main(String[] args)\n" +
" {\n" +
" X test = new X();\n" +
" Object value = test.convert(new Double(50));\n" +
" System.out.println(value);\n" +
" }\n" +
"}\n"
},
"0.5"
);
}
public void test093() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer someInteger = 12;\n" +
" System.out.println((args == null ? someInteger : \'A\') == \'A\');\n" +
" }\n" +
"}\n"
},
"true"
);
}
public void test094() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer someInteger = 12;\n" +
" System.out.println((args == null ? someInteger : \'A\') == \'A\');\n" +
" Zork z;\n" +
" }\n" +
"}\n"
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Integer someInteger = 12;\n" +
" ^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. WARNING in X.java (at line 4)\n" +
" System.out.println((args == null ? someInteger : \'A\') == \'A\');\n" +
" ^^^^^^^^^^^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"3. ERROR in X.java (at line 5)\n" +
" Zork z;\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n"
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=80630
public void test095() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" boolean b = true;\n" +
" Character _Character = new Character(\' \');\n" +
" char c = \' \';\n" +
" Integer _Integer = new Integer(2);\n" +
" if ((b ? _Character : _Integer) == c) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" } else {\n" +
" System.out.println(\"FAILURE\");\n" +
" }\n" +
" }\n" +
"}\n"
},
"SUCCESS"
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=80630 - variation
public void test096() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" boolean b = true;\n" +
" Character _Character = new Character(\' \');\n" +
" char c = \' \';\n" +
" Integer _Integer = new Integer(2);\n" +
" if ((b ? _Character : _Integer) == c) {\n" +
" System.out.println(zork);\n" +
" } else {\n" +
" System.out.println(\"FAILURE\");\n" +
" }\n" +
" }\n" +
"}\n"
},
"----------\n" +
"1. WARNING in X.java (at line 7)\n" +
" if ((b ? _Character : _Integer) == c) {\n" +
" ^^^^^^^^^^\n" +
"The expression of type Character is unboxed into int\n" +
"----------\n" +
"2. WARNING in X.java (at line 7)\n" +
" if ((b ? _Character : _Integer) == c) {\n" +
" ^^^^^^^^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"3. ERROR in X.java (at line 8)\n" +
" System.out.println(zork);\n" +
" ^^^^\n" +
"zork cannot be resolved to a variable\n" +
"----------\n"
);
}
// conditional operator: bool ? Integer : Integer --> Integer (identical operand types)
// but bool ? Integer : Short --> unboxed int
public void test097() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String args[]) {\n" +
" Integer i = 1;\n" +
" Integer j = 2;\n" +
" Short s = 3;\n" +
" foo(args != null ? i : j);\n" +
" foo(args != null ? i : s);\n" +
" }\n" +
" static void foo(int i) {\n" +
" System.out.print(\"[int:\"+i+\"]\");\n" +
" }\n" +
" static void foo(Integer i) {\n" +
" System.out.print(\"[Integer:\"+i+\"]\");\n" +
" }\n" +
"}\n"
},
"[Integer:1][int:1]"
);
}
// conditional operator: bool ? Integer : Integer --> Integer (identical operand types)
// but bool ? Integer : Short --> unboxed int
// check autoboxing warnings
public void test098() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String args[]) {\n" +
" Integer i = 1;\n" +
" Integer j = 2;\n" +
" Short s = 3;\n" +
" foo(args != null ? i : j);\n" +
" foo(args != null ? i : s);\n" +
" Zork z;\n" +
" }\n" +
" static void foo(int i) {\n" +
" System.out.print(\"[int:\"+i+\"]\");\n" +
" }\n" +
" static void foo(Integer i) {\n" +
" System.out.print(\"[Integer:\"+i+\"]\");\n" +
" }\n" +
"}\n"
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Integer i = 1;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. WARNING in X.java (at line 4)\n" +
" Integer j = 2;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"3. WARNING in X.java (at line 5)\n" +
" Short s = 3;\n" +
" ^\n" +
"The expression of type int is boxed into Short\n" +
"----------\n" +
"4. WARNING in X.java (at line 7)\n" +
" foo(args != null ? i : s);\n" +
" ^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"5. WARNING in X.java (at line 7)\n" +
" foo(args != null ? i : s);\n" +
" ^\n" +
"The expression of type Short is unboxed into int\n" +
"----------\n" +
"6. ERROR in X.java (at line 8)\n" +
" Zork z;\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n"
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84801
public void test099() {
this.runConformTest(
new String[] {
"X.java",
"public class X extends A {\n" +
" public void m(Object o) { System.out.println(\"SUCCESS\"); }\n" +
" public static void main(String[] args) { ((A) new X()).m(1); }\n" +
"}\n" +
"interface I { void m(Object o); }\n" +
"abstract class A implements I {\n" +
" public final void m(int i) {\n" +
" System.out.print(\"SUCCESS + \");\n" +
" m(new Integer(i));\n" +
" }\n" +
" public final void m(double d) {\n" +
" System.out.print(\"FAILED\");\n" +
" }\n" +
"}\n"
},
"SUCCESS + SUCCESS"
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=87267
public void test100() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Integer[] integers = {};\n" +
" int[] ints = (int[]) integers;\n" +
" float[] floats = {};\n" +
" Float[] fs = (Float[]) floats;\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
" int[] ints = (int[]) integers;\n" +
" ^^^^^^^^^^^^^^^^\n" +
"Cannot cast from Integer[] to int[]\n" +
"----------\n" +
"2. ERROR in X.java (at line 6)\n" +
" Float[] fs = (Float[]) floats;\n" +
" ^^^^^^^^^^^^^^^^\n" +
"Cannot cast from float[] to Float[]\n" +
"----------\n");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85491
public void test101() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" void foo(Object... i) { System.out.print(1); }\n" +
" void foo(int... i) { System.out.print(2); }\n" +
" public static void main(String[] args) {\n" +
" new X().foo(1);\n" +
" new X().foo(new Integer(1));\n" +
" new X().foo(1, new Integer(1));\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 5)\n" +
" new X().foo(1);\n" +
" ^^^\n" +
"The method foo(Object[]) is ambiguous for the type X\n" +
"----------\n" +
"2. ERROR in X.java (at line 6)\n" +
" new X().foo(new Integer(1));\n" +
" ^^^\n" +
"The method foo(Object[]) is ambiguous for the type X\n" +
"----------\n" +
"3. ERROR in X.java (at line 7)\n" +
" new X().foo(1, new Integer(1));\n" +
" ^^^\n" +
"The method foo(Object[]) is ambiguous for the type X\n" +
"----------\n");
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" void foo(Number... i) { System.out.print(1); }\n" +
" void foo(int... i) { System.out.print(2); }\n" +
" public static void main(String[] args) {\n" +
" new X().foo(1);\n" +
" new X().foo(new Integer(1));\n" +
" new X().foo(1, new Integer(1));\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 5)\n" +
" new X().foo(1);\n" +
" ^^^\n" +
"The method foo(Number[]) is ambiguous for the type X\n" +
"----------\n" +
"2. ERROR in X.java (at line 6)\n" +
" new X().foo(new Integer(1));\n" +
" ^^^\n" +
"The method foo(Number[]) is ambiguous for the type X\n" +
"----------\n" +
"3. ERROR in X.java (at line 7)\n" +
" new X().foo(1, new Integer(1));\n" +
" ^^^\n" +
"The method foo(Number[]) is ambiguous for the type X\n" +
"----------\n"
);
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" void foo(int i, Object... o) { System.out.print(1); }\n" +
" void foo(Integer o, int... i) { System.out.print(2); }\n" +
" public static void main(String[] args) {\n" +
" new X().foo(1);\n" +
" new X().foo(new Integer(1));\n" +
" new X().foo(1, new Integer(1));\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 5)\n" +
" new X().foo(1);\n" +
" ^^^\n" +
"The method foo(int, Object[]) is ambiguous for the type X\n" +
"----------\n" +
"2. ERROR in X.java (at line 6)\n" +
" new X().foo(new Integer(1));\n" +
" ^^^\n" +
"The method foo(int, Object[]) is ambiguous for the type X\n" +
"----------\n" +
"3. ERROR in X.java (at line 7)\n" +
" new X().foo(1, new Integer(1));\n" +
" ^^^\n" +
"The method foo(int, Object[]) is ambiguous for the type X\n" +
"----------\n"
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84801
public void test102() {
runConformTest(
// test directory preparation
true /* flush output directory */,
new String[] { /* test files */
"X.java",
"class Cla<A> {\n" +
" A val;\n" +
" public Cla(A x) { val = x; }\n" +
" A getVal() { return val; }\n" +
"}\n" +
"\n" +
"public class X {\n" +
" \n" +
" void proc0(Cla<Long> b0) {\n" +
" final Long t1 = b0.getVal();\n" +
" System.out.print(t1);\n" +
" final long t2 = b0.getVal();\n" +
" System.out.print(t2);\n" +
" }\n" +
"\n" +
" void proc1(Cla<? extends Long> obj) {\n" +
" final Long t3 = obj.getVal();\n" +
" System.out.print(t3);\n" +
" final long t4 = obj.getVal();\n" +
" System.out.print(t4);\n" +
" }\n" +
" \n" +
" <U extends Long> void proc2(Cla<U> obj) {\n" +
" final Long t5 = obj.getVal();\n" +
" System.out.print(t5);\n" +
" final long t6 = obj.getVal();\n" +
" System.out.println(t6);\n" +
" }\n" +
" \n" +
" public static void main(String[] args) {\n" +
" X x = new X();\n" +
" x.proc0(new Cla<Long>(0l));\n" +
" x.proc1(new Cla<Long>(1l));\n" +
" x.proc2(new Cla<Long>(2l));\n" +
" }\n" +
"}\n"
},
// compiler results
null /* do not check compiler log */,
// runtime results
"001122" /* expected output string */,
"" /* expected error string */,
// javac options
JavacTestOptions.JavacHasABug.JavacBugFixed_6_10 /* javac test options */);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84801 - variation (check warnings)
public void test103() {
this.runNegativeTest(
new String[] {
"X.java",
"class Cla<A> {\n" +
" Zork z;\n" +
" A val;\n" +
" public Cla(A x) { val = x; }\n" +
" A getVal() { return val; }\n" +
"}\n" +
"\n" +
"public class X {\n" +
" \n" +
" void proc0(Cla<Long> b0) {\n" +
" final Long t1 = b0.getVal();\n" +
" System.out.print(t1);\n" +
" final long t2 = b0.getVal();\n" +
" System.out.print(t2);\n" +
" }\n" +
"\n" +
" void proc1(Cla<? extends Long> obj) {\n" +
" final Long t3 = obj.getVal();\n" +
" System.out.print(t3);\n" +
" final long t4 = obj.getVal();\n" +
" System.out.print(t4);\n" +
" }\n" +
" \n" +
" <U extends Long> void proc2(Cla<U> obj) {\n" +
" final Long t5 = obj.getVal();\n" +
" System.out.print(t5);\n" +
" final long t6 = obj.getVal();\n" +
" System.out.printltn(t6);\n" +
" }\n" +
" \n" +
" public static void main(String[] args) {\n" +
" X x = new X();\n" +
" x.proc0(new Cla<Long>(0l));\n" +
" x.proc1(new Cla<Long>(1l));\n" +
" x.proc2(new Cla<Long>(2l));\n" +
" }\n" +
"}\n"
},
"----------\n" +
"1. ERROR in X.java (at line 2)\n" +
" Zork z;\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n" +
"2. WARNING in X.java (at line 13)\n" +
" final long t2 = b0.getVal();\n" +
" ^^^^^^^^^^^\n" +
"The expression of type Long is unboxed into long\n" +
"----------\n" +
"3. WARNING in X.java (at line 20)\n" +
" final long t4 = obj.getVal();\n" +
" ^^^^^^^^^^^^\n" +
"The expression of type capture#2-of ? extends Long is unboxed into long\n" +
"----------\n" +
"4. WARNING in X.java (at line 24)\n" +
" <U extends Long> void proc2(Cla<U> obj) {\n" +
" ^^^^\n" +
"The type parameter U should not be bounded by the final type Long. Final types cannot be further extended\n" +
"----------\n" +
"5. WARNING in X.java (at line 27)\n" +
" final long t6 = obj.getVal();\n" +
" ^^^^^^^^^^^^\n" +
"The expression of type U is unboxed into long\n" +
"----------\n" +
"6. ERROR in X.java (at line 28)\n" +
" System.out.printltn(t6);\n" +
" ^^^^^^^^\n" +
"The method printltn(long) is undefined for the type PrintStream\n" +
"----------\n" +
"7. WARNING in X.java (at line 33)\n" +
" x.proc0(new Cla<Long>(0l));\n" +
" ^^\n" +
"The expression of type long is boxed into Long\n" +
"----------\n" +
"8. WARNING in X.java (at line 34)\n" +
" x.proc1(new Cla<Long>(1l));\n" +
" ^^\n" +
"The expression of type long is boxed into Long\n" +
"----------\n" +
"9. WARNING in X.java (at line 35)\n" +
" x.proc2(new Cla<Long>(2l));\n" +
" ^^\n" +
"The expression of type long is boxed into Long\n" +
"----------\n");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95868
public void test104() {
this.runConformTest(
new String[] {
"X.java",
"import java.util.HashMap;\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" try {\n" +
" String x = \"\";\n" +
" HashMap<String, Integer> y = new HashMap<String, Integer>();\n" +
" Integer w = (x.equals(\"X\") ? 0 : y.get(\"yKey\"));\n" +
" } catch(NullPointerException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}\n"
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101779
public void test105() {
runConformTest(
// test directory preparation
true /* flush output directory */,
new String[] { /* test files */
"X.java",
"final class Pair<F, S> {\n" +
" public F first;\n" +
" public S second;\n" +
"\n" +
" public static <F, S> Pair<F, S> create(F f, S s) {\n" +
" return new Pair<F, S>(f, s);\n" +
" }\n" +
"\n" +
" public Pair(final F f, final S s) {\n" +
" first = f;\n" +
" second = s;\n" +
" }\n" +
"}\n" +
"\n" +
"public class X {\n" +
" public void a() {\n" +
" Pair<Integer, Integer> p = Pair.create(1, 3);\n" +
" // p.first -= 1; // should be rejected ?\n" +
" p.first--;\n" +
" --p.first;\n" +
" p.first = p.first - 1;\n" +
" System.out.println(p.first);\n" +
" }\n" +
"\n" +
" public static void main(final String[] args) {\n" +
" new X().a();\n" +
" }\n" +
"}\n",
},
// compiler results
null /* do not check compiler log */,
// runtime results
"-2" /* expected output string */,
"" /* expected error string */,
// javac options
JavacTestOptions.JavacHasABug.JavacBugFixed_6_10 /* javac test options */);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101779 - variation
public void test106() {
runConformTest(
// test directory preparation
true /* flush output directory */,
new String[] { /* test files */
"X.java",
"class XSuper<T> {\n" +
" T value;\n" +
"}\n" +
"public class X extends XSuper<Integer>{\n" +
" public void a() {\n" +
" value--;\n" +
" --value;\n" +
" value -= 1;\n" +
" value = value - 1;\n" +
" System.out.println(value);\n" +
" }\n" +
"\n" +
" public static void main(final String[] args) {\n" +
" X x = new X();\n" +
" x.value = 5;\n" +
" x.a();\n" +
" }\n" +
"}\n",
},
// compiler results
null /* do not check compiler log */,
// runtime results
"1" /* expected output string */,
"" /* expected error string */,
// javac options
JavacTestOptions.JavacHasABug.JavacBugFixed_6_10 /* javac test options */);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101779 - variation
public void test107() {
runConformTest(
// test directory preparation
true /* flush output directory */,
new String[] { /* test files */
"X.java",
"class XSuper<T> {\n" +
" T value;\n" +
"}\n" +
"public class X extends XSuper<Integer>{\n" +
" public void a() {\n" +
" this.value--;\n" +
" --this.value;\n" +
" this.value -= 1;\n" +
" this.value = this.value - 1;\n" +
" System.out.println(this.value);\n" +
" }\n" +
"\n" +
" public static void main(final String[] args) {\n" +
" X x = new X();\n" +
" x.value = 5;\n" +
" x.a();\n" +
" }\n" +
"}\n",
},
// compiler results
null /* do not check compiler log */,
// runtime results
"1" /* expected output string */,
"" /* expected error string */,
// javac options
JavacTestOptions.JavacHasABug.JavacBugFixed_6_10 /* javac test options */);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101779 - variation
public void test108() {
runConformTest(
// test directory preparation
true /* flush output directory */,
new String[] { /* test files */
"X.java",
"class XSuper<T> {\n" +
" T value;\n" +
"}\n" +
"public class X extends XSuper<Integer>{\n" +
" public static void a(X x) {\n" +
" x.value--;\n" +
" --x.value;\n" +
" x.value -= 1;\n" +
" x.value = x.value - 1;\n" +
" System.out.println(x.value);\n" +
" }\n" +
"\n" +
" public static void main(final String[] args) {\n" +
" X x = new X();\n" +
" x.value = 5;\n" +
" a(x);\n" +
" }\n" +
"}\n",
},
// compiler results
null /* do not check compiler log */,
// runtime results
"1" /* expected output string */,
"" /* expected error string */,
// javac options
JavacTestOptions.JavacHasABug.JavacBugFixed_6_10 /* javac test options */);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100043
public void test109() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" int foo = 0;\n" +
" String bar = \"zero\";\n" +
" System.out.println((foo != 0) ? foo : bar);\n" +
" }\n" +
"}\n",
},
"zero");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100043 - variation
public void test110() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String args[]) {\n" +
" if (new Boolean(true) ? true : new Boolean(false)) {\n" +
" System.out.print(\"SUCCESS\");\n" +
" } else {\n" +
" System.out.print(\"FAILED\");\n" +
" }\n" +
" }\n" +
"}\n",
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=105524
public void test111() {
runConformTest(
// test directory preparation
true /* flush output directory */,
new String[] { /* test files */
"X.java",
"class Wrapper< T >\n" +
"{\n" +
" public T value;\n" +
"}\n" +
"\n" +
"public class X\n" +
"{\n" +
" public static void main( final String[ ] args )\n" +
" {\n" +
" final Wrapper< Integer > wrap = new Wrapper< Integer >( );\n" +
" wrap.value = 0;\n" +
" wrap.value = wrap.value + 1; // works\n" +
" wrap.value++; // throws VerifyError\n" +
" wrap.value += 1; // throws VerifyError\n" +
" }\n" +
"}\n",
},
// compiler results
null /* do not check compiler log */,
// runtime results
"" /* expected output string */,
"" /* expected error string */,
// javac options
JavacTestOptions.JavacHasABug.JavacBugFixed_6_10 /* javac test options */);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=105284
public void test112() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Short s;\n" +
" s = 5; // Type mismatch: cannot convert from int to Short\n" +
" Short[] shorts = { 0, 1, 2, 3 };\n" +
" System.out.println(s+shorts[2]);\n" +
" }\n" +
"}\n",
},
"7");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=105284 - variation
public void test113() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Short s;\n" +
" s = 5; // Type mismatch: cannot convert from int to Short\n" +
"\n" +
" int i = 0;\n" +
" s = i; // not a constant\n" +
" \n" +
" bar(4);\n" +
" Short[] shorts = { 0, 1, 2, 3 };\n" +
" }\n" +
" void bar(Short s) {}\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 4)\n" +
" s = 5; // Type mismatch: cannot convert from int to Short\n" +
" ^\n" +
"The expression of type int is boxed into Short\n" +
"----------\n" +
"2. ERROR in X.java (at line 7)\n" +
" s = i; // not a constant\n" +
" ^\n" +
"Type mismatch: cannot convert from int to Short\n" +
"----------\n" +
"3. ERROR in X.java (at line 9)\n" +
" bar(4);\n" +
" ^^^\n" +
"The method bar(Short) in the type X is not applicable for the arguments (int)\n" +
"----------\n" +
"4. WARNING in X.java (at line 10)\n" +
" Short[] shorts = { 0, 1, 2, 3 };\n" +
" ^\n" +
"The expression of type int is boxed into Short\n" +
"----------\n" +
"5. WARNING in X.java (at line 10)\n" +
" Short[] shorts = { 0, 1, 2, 3 };\n" +
" ^\n" +
"The expression of type int is boxed into Short\n" +
"----------\n" +
"6. WARNING in X.java (at line 10)\n" +
" Short[] shorts = { 0, 1, 2, 3 };\n" +
" ^\n" +
"The expression of type int is boxed into Short\n" +
"----------\n" +
"7. WARNING in X.java (at line 10)\n" +
" Short[] shorts = { 0, 1, 2, 3 };\n" +
" ^\n" +
"The expression of type int is boxed into Short\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100182
public void test114() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" char c = \'a\';\n" +
" System.out.printf(\"%c\",c); \n" +
" System.out.printf(\"%d\\n\",(int)c); \n" +
" }\n" +
" Zork z;\n" +
"}\n" ,
},
// ensure no unnecessary cast warning
"----------\n" +
"1. WARNING in X.java (at line 4)\r\n" +
" System.out.printf(\"%c\",c); \r\n" +
" ^\n" +
"The expression of type char is boxed into Character\n" +
"----------\n" +
"2. WARNING in X.java (at line 5)\r\n" +
" System.out.printf(\"%d\\n\",(int)c); \r\n" +
" ^^^^^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"3. ERROR in X.java (at line 7)\r\n" +
" Zork z;\r\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100182 - variation
public void test115() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" char c = \'a\';\n" +
" System.out.printf(\"%c\",c); \n" +
" System.out.printf(\"%d\\n\",(int)c); \n" +
" }\n" +
"}\n",
},
"a97");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106870
public void test116() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" boolean foo(Long l, Float f) {\n" +
" return f == l;\n" +
" }\n" +
" float bar(Long l, Float f) {\n" +
" return this == null ? f : l;\n" +
" }\n" +
" double baz(Long l, Float f) {\n" +
" return this == null ? f : l;\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 3)\r\n" +
" return f == l;\r\n" +
" ^^^^^^\n" +
"Incompatible operand types Float and Long\n" +
"----------\n" +
"2. WARNING in X.java (at line 6)\r\n" +
" return this == null ? f : l;\r\n" +
" ^\n" +
"The expression of type Float is unboxed into float\n" +
"----------\n" +
"3. WARNING in X.java (at line 6)\r\n" +
" return this == null ? f : l;\r\n" +
" ^\n" +
"The expression of type Long is unboxed into float\n" +
"----------\n" +
"4. WARNING in X.java (at line 9)\r\n" +
" return this == null ? f : l;\r\n" +
" ^\n" +
"The expression of type Float is unboxed into float\n" +
"----------\n" +
"5. WARNING in X.java (at line 9)\r\n" +
" return this == null ? f : l;\r\n" +
" ^\n" +
"The expression of type Long is unboxed into float\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=122987
public void test117() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args)\n" +
" {\n" +
" Object obj = true ? true : 17.3;\n" +
" Zork z;\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 4)\n" +
" Object obj = true ? true : 17.3;\n" +
" ^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"2. WARNING in X.java (at line 4)\n" +
" Object obj = true ? true : 17.3;\n" +
" ^^^^\n" +
"The expression of type double is boxed into Double\n" +
"----------\n" +
"3. ERROR in X.java (at line 5)\n" +
" Zork z;\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n");
}
// Integer array and method with T extends Integer bound
public void test118() {
runConformTest(
// test directory preparation
true /* flush output directory */,
new String[] { /* test files */
"X.java",
"public class X {\n" +
" public static <T extends Integer> void foo(final T[] p) {\n" +
// we have a warning here, since no class can extend Integer, but the code
// still needs to execute
" System.out.println(p[0] / 4);\n" +
" }\n" +
" public static void main(final String[] args) {\n" +
" X.foo(new Integer[] { 4, 8, 16 });\n" +
" }\n" +
"}",
},
// compiler results
null /* do not check compiler log */,
// runtime results
"1" /* expected output string */,
"" /* expected error string */,
// javac options
JavacTestOptions.JavacHasABug.JavacBug6575821 /* javac test options */);
}
// Integer as member of a parametrized class
public void test119() {
runConformTest(
// test directory preparation
true /* flush output directory */,
new String[] { /* test files */
"X.java",
"public class X<T> {\n" +
" T m;\n" +
" X(T p) {\n" +
" this.m = p;\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" X<Integer> l = new X<Integer>(0);\n" + // boxing
" l.m++;\n" + // boxing + unboxing
" System.out.println(l.m);\n" +
" }\n" +
"}",
},
// compiler results
null /* do not check compiler log */,
// runtime results
"1" /* expected output string */,
"" /* expected error string */,
// javac options
JavacTestOptions.JavacHasABug.JavacBugFixed_6_10 /* javac test options */);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=137918
public void test120() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" int a = 100;\n" +
" boolean c = a instanceof Integer;\n" +
" Integer i = (Integer) a;\n" +
" System.out.println(c);\n" +
" }\n" +
"}\n"
},
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
" boolean c = a instanceof Integer;\n" +
" ^^^^^^^^^^^^^^^^^^^^\n" +
"Incompatible conditional operand types int and Integer\n" +
"----------\n" +
"2. WARNING in X.java (at line 5)\n" +
" Integer i = (Integer) a;\n" +
" ^^^^^^^^^^^\n" +
"Unnecessary cast from int to Integer\n" +
"----------\n" +
"3. WARNING in X.java (at line 5)\n" +
" Integer i = (Integer) a;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=156108
public void test121() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" void foo() {\n" +
" final int i = -128;\n" +
" Byte b = i;\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" Byte no = 127; // warning: int boxed to Byte > fine\n" +
" switch (no) { // warning: Byte is unboxed into int > why in int??? output\n" +
" case -128: // error: cannot convert int to Byte > needs a explicit (byte)cast.\n" +
" break;\n" +
" case (byte) 127: // works\n" +
" break;\n" +
" }\n" +
" no = new Byte(127);\n" +
" }\n" +
"}", // =================
},
"----------\n" +
"1. WARNING in X.java (at line 4)\n" +
" Byte b = i;\n" +
" ^\n" +
"The expression of type int is boxed into Byte\n" +
"----------\n" +
"2. WARNING in X.java (at line 7)\n" +
" Byte no = 127; // warning: int boxed to Byte > fine\n" +
" ^^^\n" +
"The expression of type int is boxed into Byte\n" +
"----------\n" +
"3. WARNING in X.java (at line 8)\n" +
" switch (no) { // warning: Byte is unboxed into int > why in int??? output\n" +
" ^^\n" +
"The expression of type Byte is unboxed into int\n" +
"----------\n" +
"4. ERROR in X.java (at line 14)\n" +
" no = new Byte(127);\n" +
" ^^^^^^^^^^^^^\n" +
"The constructor Byte(int) is undefined\n" +
"----------\n"
);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=156108 - variation
public void test122() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" Byte foo() {\n" +
" final int i = -128;\n" +
" return i;\n" +
" }\n" +
" Byte bar() {\n" +
" final int i = 1000;\n" +
" return i;\n" +
" } \n" +
"}", // =================
},
"----------\n" +
"1. WARNING in X.java (at line 4)\n" +
" return i;\n" +
" ^\n" +
"The expression of type int is boxed into Byte\n" +
"----------\n" +
"2. ERROR in X.java (at line 8)\n" +
" return i;\n" +
" ^\n" +
"Type mismatch: cannot convert from int to Byte\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155255
public void test123() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" foo1();\n" +
" foo2();\n" +
" foo3();\n" +
" foo4();\n" +
" System.out.println(\"[done]\");\n" +
" }\n" +
" static void foo1() {\n" +
" Object x = true ? true : \"\";\n" +
" System.out.print(\"[1:\"+ x + \",\" + x.getClass().getCanonicalName() + \"]\");\n" +
" }\n" +
" static void foo2() {\n" +
" Object x = Boolean.TRUE != null ? true : \"\";\n" +
" System.out.print(\"[2:\"+ x + \",\" + x.getClass().getCanonicalName() + \"]\");\n" +
" }\n" +
" static void foo3() {\n" +
" Object x = false ? \"\" : false;\n" +
" System.out.print(\"[3:\"+ x + \",\" + x.getClass().getCanonicalName() + \"]\");\n" +
" }\n" +
" static void foo4() {\n" +
" Object x = Boolean.TRUE == null ? \"\" : false;\n" +
" System.out.print(\"[4:\"+ x + \",\" + x.getClass().getCanonicalName() + \"]\");\n" +
" }\n" +
"}", // =================
},
"[1:true,java.lang.Boolean][2:true,java.lang.Boolean][3:false,java.lang.Boolean][4:false,java.lang.Boolean][done]");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155255 - variation
public void test124() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" static void foo5() {\n" +
" boolean x = false ? \"\" : false;\n" +
" System.out.print(\"[4:\"+ x + \",\" + x.getClass().getCanonicalName() + \"]\");\n" +
" } \n" +
"}", // =================
},
this.complianceLevel >= ClassFileConstants.JDK1_8 ?
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" boolean x = false ? \"\" : false;\n" +
" ^^\n" +
"Type mismatch: cannot convert from String to boolean\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
" System.out.print(\"[4:\"+ x + \",\" + x.getClass().getCanonicalName() + \"]\");\n" +
" ^^^^^^^^^^^^\n" +
"Cannot invoke getClass() on the primitive type boolean\n" +
"----------\n" :
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" boolean x = false ? \"\" : false;\n" +
" ^^^^^^^^^^^^^^^^^^\n" +
"Type mismatch: cannot convert from Object&Serializable&Comparable<?> to boolean\n" +
"----------\n" +
"2. WARNING in X.java (at line 3)\n" +
" boolean x = false ? \"\" : false;\n" +
" ^^^^^\n" +
"The expression of type boolean is boxed into Boolean\n" +
"----------\n" +
"3. ERROR in X.java (at line 4)\n" +
" System.out.print(\"[4:\"+ x + \",\" + x.getClass().getCanonicalName() + \"]\");\n" +
" ^^^^^^^^^^^^\n" +
"Cannot invoke getClass() on the primitive type boolean\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155255 - variation
public void test125() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" foo1();\n" +
" foo2();\n" +
" foo3();\n" +
" System.out.println(\"[done]\");\n" +
" }\n" +
" static void foo1() {\n" +
" Object x = true ? 3.0f : false;\n" +
" System.out.print(\"[1:\"+ x + \",\" + x.getClass().getCanonicalName() + \"]\");\n" +
" }\n" +
" static void foo2() {\n" +
" Object x = true ? 2 : false;\n" +
" System.out.print(\"[2:\"+ x + \",\" + x.getClass().getCanonicalName() + \"]\");\n" +
" }\n" +
" static void foo3() {\n" +
" Object x = false ? 2 : false;\n" +
" System.out.print(\"[3:\"+ x + \",\" + x.getClass().getCanonicalName() + \"]\");\n" +
" }\n" +
"}\n", // =================
},
"[1:3.0,java.lang.Float][2:2,java.lang.Integer][3:false,java.lang.Boolean][done]");
}
public void test126() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" void foo(boolean b) {\n" +
" int i = 12;\n" +
" Integer r1 = b ? null : i;\n" +
" int r2 = b ? null : i;\n" +
" }\n" +
" Zork z;\n" +
"}\n", // =================
},
"----------\n" +
"1. WARNING in X.java (at line 4)\n" +
" Integer r1 = b ? null : i;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. WARNING in X.java (at line 5)\n" +
" int r2 = b ? null : i;\n" +
" ^^^^^^^^^^^^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"3. WARNING in X.java (at line 5)\n" +
" int r2 = b ? null : i;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"4. ERROR in X.java (at line 7)\n" +
" Zork z;\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n");
}
public void test127() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" Object[] os1 = new Object[] {(long)1234567};\n" +
" Object[] os2 = new Object[] {1234567};\n" +
" Object o1 = os1[0], o2 = os2[0];\n" +
" if (o1.getClass().equals(o2.getClass())) {\n" +
" System.out.println(\"FAILED:o1[\"+o1.getClass().getName()+\"],o2:[\"+o2.getClass()+\"]\");\n" +
" } else {\n" +
" System.out.println(\"SUCCESS:o1[\"+o1.getClass().getName()+\"],o2:[\"+o2.getClass()+\"]\");\n" +
" }\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS:o1[java.lang.Long],o2:[class java.lang.Integer]");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159987
public void test128() {
// check there is no unncessary cast warning when autoboxing, even in array initializer
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] s) {\n" +
" Object o1 = (long) 1234567;\n" +
" Object[] os1 = new Object[] { (long) 1234567 };\n" +
" Object[] os2 = { (long) 1234567 };\n" +
" foo((long) 1234567);\n" +
" }\n" +
" static void foo(Object o) {\n" +
" }\n" +
" Zork z;\n" +
"}\n", // =================
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Object o1 = (long) 1234567;\n" +
" ^^^^^^^^^^^^^^\n" +
"The expression of type long is boxed into Long\n" +
"----------\n" +
"2. WARNING in X.java (at line 4)\n" +
" Object[] os1 = new Object[] { (long) 1234567 };\n" +
" ^^^^^^^^^^^^^^\n" +
"The expression of type long is boxed into Long\n" +
"----------\n" +
"3. WARNING in X.java (at line 5)\n" +
" Object[] os2 = { (long) 1234567 };\n" +
" ^^^^^^^^^^^^^^\n" +
"The expression of type long is boxed into Long\n" +
"----------\n" +
"4. WARNING in X.java (at line 6)\n" +
" foo((long) 1234567);\n" +
" ^^^^^^^^^^^^^^\n" +
"The expression of type long is boxed into Long\n" +
"----------\n" +
"5. ERROR in X.java (at line 10)\n" +
" Zork z;\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155104
public void test129() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X{\n" +
" java.io.Serializable field=this==null?8:\"\".getBytes();\n" +
" Zork z;\n" +
"}\n", // =================
},
"----------\n" +
"1. WARNING in X.java (at line 2)\r\n" +
" java.io.Serializable field=this==null?8:\"\".getBytes();\r\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. ERROR in X.java (at line 3)\r\n" +
" Zork z;\r\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=174879
public void test130() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" Boolean[] myBool = new Boolean[1];\n" +
" void foo() {\n" +
" if (this.myBool[0]) {}\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" try {\n" +
" new X().foo();\n" +
" System.out.println(\"FAILURE\");\n" +
" } catch(NullPointerException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}",
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=174879
public void test131() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" Boolean myBool = null;\n" +
" void foo() {\n" +
" if (myBool) {}\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" try {\n" +
" new X().foo();\n" +
" System.out.println(\"FAILURE\");\n" +
" } catch(NullPointerException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}",
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=174879
public void test132() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" static Boolean myBool = null;\n" +
" static void foo() {\n" +
" if (myBool) {}\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" try {\n" +
" foo();\n" +
" System.out.println(\"FAILURE\");\n" +
" } catch(NullPointerException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}",
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=174879
public void test133() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" Boolean myBool = null;\n" +
" void foo() {\n" +
" if (this.myBool) {}\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" try {\n" +
" new X().foo();\n" +
" System.out.println(\"FAILURE\");\n" +
" } catch(NullPointerException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}",
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=174879
public void test134() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" static Boolean MyBool = null;\n" +
" static void foo() {\n" +
" if (X.MyBool) {}\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" try {\n" +
" foo();\n" +
" System.out.println(\"FAILURE\");\n" +
" } catch(NullPointerException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}",
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372
public void test135() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A<T> {\n" +
" public T foo() { return null; }\n" +
"}\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" A<Long> a = new A<Long>();\n" +
" A ua = a;\n" +
" try {\n" +
" long s = a.foo();\n" +
" } catch(NullPointerException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" return;\n" +
" }\n" +
" System.out.println(\"FAILED\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test136() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A<T> {\n" +
" public T foo(Object o) {\n" +
" return (T) o; // should get unchecked warning\n" +
" }\n" +
"}\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" A<Long> a = new A<Long>();\n" +
" try {\n" +
" long s = a.foo(new Object());\n" +
" } catch(ClassCastException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" return;\n" +
" }\n" +
" System.out.println(\"FAILED\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test137() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A<T> {\n" +
" public T foo;\n" +
"}\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" A<Long> a = new A<Long>();\n" +
" A ua = a;\n" +
" ua.foo = new Object();\n" +
" try {\n" +
" long s = a.foo;\n" +
" } catch(ClassCastException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" return;\n" +
" }\n" +
" System.out.println(\"FAILED\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test138() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A<T> {\n" +
" public T foo;\n" +
"}\n" +
"\n" +
"public class X extends A<Long>{\n" +
" public static void main(String[] args) {\n" +
" new X().foo();\n" +
" }\n" +
" public void foo() {\n" +
" A ua = this;\n" +
" ua.foo = new Object();\n" +
" try {\n" +
" long s = foo;\n" +
" } catch(ClassCastException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" return;\n" +
" }\n" +
" System.out.println(\"FAILED\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test139() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A<T> {\n" +
" public T foo;\n" +
"}\n" +
"\n" +
"public class X extends A<Long>{\n" +
" public static void main(String[] args) {\n" +
" new X().foo();\n" +
" }\n" +
" public void foo() {\n" +
" A ua = this;\n" +
" ua.foo = new Object();\n" +
" try {\n" +
" long s = this.foo;\n" +
" } catch(ClassCastException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" return;\n" +
" }\n" +
" System.out.println(\"FAILED\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test140() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A {\n" +
" long foo() {\n" +
" return 0L;\n" +
" }\n" +
"}\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" A a = new A();\n" +
" Long s = a.foo();\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test141() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A {\n" +
" long foo = 0L;\n" +
"}\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" A a = new A();\n" +
" Long s = a.foo;\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test142() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A {\n" +
" long foo = 0L;\n" +
"}\n" +
"\n" +
"public class X extends A {\n" +
" public static void main(String[] args) {\n" +
" new X().bar();\n" +
" }\n" +
" void bar() {\n" +
" Long s = foo;\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test143() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A {\n" +
" long foo = 0L;\n" +
"}\n" +
"\n" +
"public class X extends A {\n" +
" public static void main(String[] args) {\n" +
" new X().bar();\n" +
" }\n" +
" void bar() {\n" +
" Long s = this.foo;\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test144() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A<T> {\n" +
" public T[] foo;\n" +
"}\n" +
"\n" +
"public class X extends A<Long>{\n" +
" public static void main(String[] args) {\n" +
" new X().foo();\n" +
" }\n" +
" public void foo() {\n" +
" A ua = this;\n" +
" ua.foo = new Object[1];\n" +
" try {\n" +
" long s = this.foo[0];\n" +
" } catch(ClassCastException e) {\n" +
" System.out.println(\"SUCCESS\");\n" +
" return;\n" +
" }\n" +
" System.out.println(\"FAILED\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test145() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A {\n" +
" long[] foo = { 0L };\n" +
"}\n" +
"\n" +
"public class X extends A {\n" +
" public static void main(String[] args) {\n" +
" new X().bar();\n" +
" }\n" +
" void bar() {\n" +
" Long s = this.foo[0];\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177372 - variation
public void test146() {
Map settings = getCompilerOptions();
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
this.runConformTest(
new String[] {
"X.java",
"class A<T> {\n" +
" public T foo;\n" +
"}\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) {\n" +
" A<Long> a = new A<Long>();\n" +
" long s = a.foo.MAX_VALUE;\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}\n", // =================
},
"SUCCESS",
null,
true,
null,
settings,
null);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=184957
public void test147() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" if(new Integer(2) == 0) {}\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}",
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=184957
public void test148() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Z test = new Z(1, 1);\n" +
" System.out.println(\"SUCCESS\" + test.foo());\n" +
" }\n" +
"}",
"Z.java",
"class Z {\n" +
" public <A, B extends A> Z(A a, B b) {\n" +
" }\n" +
" public int foo() {\n" +
" return 0;\n" +
" }\n" +
"}"
},
"SUCCESS0");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=184957
public void test149() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" Z test = new Z(1, 1);\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}",
"Z.java",
"class Z {\n" +
" public <A, B extends A> Z(A a, B b) {\n" +
" }\n" +
"}"
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=184957
public void test150() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" if(new Integer(2) == 0) {\n" +
" System.out.println(\"FAILED\");\n" +
" } else {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}",
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=184957
public void test151() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" if(new Double(2.0) == 0.0) {\n" +
" System.out.println(\"FAILED\");\n" +
" } else {\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
" }\n" +
"}",
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=184957
public void test152() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
" if(new Double(2.0) == 0.0) {}\n" +
" System.out.println(\"SUCCESS\");\n" +
" }\n" +
"}",
},
"SUCCESS");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=223685
public void test153() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" void foo() {\n" +
" Integer a = 0;\n" +
" char b = (char)((int)a);\n" +
" char c = (char)(a + 1);\n" +
" char d = (char)(a);\n" +
" int e = (int) a;\n" +
" Integer f = (Integer) e;\n" +
" }\n" +
" void bar() {\n" +
" X x = (X) null;\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Integer a = 0;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. WARNING in X.java (at line 4)\n" +
" char b = (char)((int)a);\n" +
" ^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"3. WARNING in X.java (at line 5)\n" +
" char c = (char)(a + 1);\n" +
" ^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"4. ERROR in X.java (at line 6)\n" +
" char d = (char)(a);\n" +
" ^^^^^^^^^\n" +
"Cannot cast from Integer to char\n" +
"----------\n" +
"5. WARNING in X.java (at line 7)\n" +
" int e = (int) a;\n" +
" ^^^^^^^\n" +
"Unnecessary cast from Integer to int\n" +
"----------\n" +
"6. WARNING in X.java (at line 7)\n" +
" int e = (int) a;\n" +
" ^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"7. WARNING in X.java (at line 8)\n" +
" Integer f = (Integer) e;\n" +
" ^^^^^^^^^^^\n" +
"Unnecessary cast from int to Integer\n" +
"----------\n" +
"8. WARNING in X.java (at line 8)\n" +
" Integer f = (Integer) e;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"9. WARNING in X.java (at line 11)\n" +
" X x = (X) null;\n" +
" ^^^^^^^^\n" +
"Unnecessary cast from null to X\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565
public void test154() {
this.runConformTest(
new String[] {
"X.java",
"public class X<T> {\n" +
" T counter;\n" +
" public static void main(String[] args) {\n" +
" bar(new X<Integer>());\n" +
" new Y().foo();\n" +
" new Y().baz();\n" +
" }\n" +
" static void bar(X<Integer> x) {\n" +
" x.counter = 0;\n" +
" System.out.print(Integer.toString(x.counter++));\n" +
" }\n" +
"}\n" +
"\n" +
"class Y extends X<Integer> {\n" +
" Y() {\n" +
" this.counter = 0;\n" +
" }\n" +
" void foo() {\n" +
" System.out.print(Integer.toString(counter++));\n" +
" }\n" +
" void baz() {\n" +
" System.out.println(Integer.toString(this.counter++));\n" +
" }\n" +
"}\n",
},
"000");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 - variation
public void test155() {
this.runConformTest(
new String[] {
"X.java",
"public class X<T> {\n" +
" T[] counter;\n" +
" public static void main(String[] args) {\n" +
" bar(new X<Integer>());\n" +
" new Y().foo();\n" +
" new Y().baz();\n" +
" }\n" +
" static void bar(X<Integer> x) {\n" +
" x.counter = new Integer[]{ 0 };\n" +
" System.out.print(Integer.toString(x.counter[0]++));\n" +
" }\n" +
"}\n" +
"\n" +
"class Y extends X<Integer> {\n" +
" Y() {\n" +
" this.counter = new Integer[]{ 0 };\n" +
" }\n" +
" void foo() {\n" +
" System.out.print(Integer.toString(counter[0]++));\n" +
" }\n" +
" void baz() {\n" +
" System.out.println(Integer.toString(this.counter[0]++));\n" +
" }\n" +
"}\n",
},
"000");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 - variation
public void test156() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" static void print(Character c) {\n" +
" System.out.print((char) c);\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" char c = \'H\';\n" +
" print(c++);\n" +
" print(c++);\n" +
" System.out.println(\"done\");\n" +
" }\n" +
"}\n",
},
"HIdone");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 - variation
public void test157() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" char c = \'H\';\n" +
" static void print(Character c) {\n" +
" System.out.print((char) c);\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" X x = new X();\n" +
" print(x.c++);\n" +
" print(x.c++);\n" +
" System.out.println(\"done\");\n" +
" }\n" +
"}\n",
},
"HIdone");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 - variation
public void test158() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" static X singleton = new X();\n" +
" static X singleton() { return singleton; }\n" +
" char c = \'H\';\n" +
" \n" +
" static void print(Character c) {\n" +
" System.out.print((char) c);\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" print(singleton().c++);\n" +
" print(singleton().c++);\n" +
" System.out.println(\"done\");\n" +
" }\n" +
"}\n",
},
"HIdone");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=236019
public void test159() {
this.runNegativeTest(
new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"public class X {\n" +
" ArrayList params;\n" +
" public int getSqlParamCount() {\n" +
" return params == null ? null:params.size();\n" +
" }\n" +
" public int getSqlParamCount2() {\n" +
" return null;\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" ArrayList params;\n" +
" ^^^^^^^^^\n" +
"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" +
"----------\n" +
"2. WARNING in X.java (at line 5)\n" +
" return params == null ? null:params.size();\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"3. WARNING in X.java (at line 5)\n" +
" return params == null ? null:params.size();\n" +
" ^^^^^^^^^^^^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"4. ERROR in X.java (at line 8)\n" +
" return null;\n" +
" ^^^^\n" +
"Type mismatch: cannot convert from null to int\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 - variation
public void test160() {
this.runConformTest(
new String[] {
"X.java",
"public class X<T> {\n" +
" T counter;\n" +
" public static void main(String[] args) {\n" +
" bar(new X<Integer>());\n" +
" new Y().foo();\n" +
" new Y().baz();\n" +
" }\n" +
" static void bar(X<Integer> x) {\n" +
" x.counter = 0;\n" +
" System.out.print(Integer.toString(++x.counter));\n" +
" }\n" +
"}\n" +
"\n" +
"class Y extends X<Integer> {\n" +
" Y() {\n" +
" this.counter = 0;\n" +
" }\n" +
" void foo() {\n" +
" System.out.print(Integer.toString(++counter));\n" +
" }\n" +
" void baz() {\n" +
" System.out.println(Integer.toString(++this.counter));\n" +
" }\n" +
"}\n",
},
"111");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 - variation
public void test161() {
this.runConformTest(
new String[] {
"X.java",
"public class X<T> {\n" +
" T[] counter;\n" +
" public static void main(String[] args) {\n" +
" bar(new X<Integer>());\n" +
" new Y().foo();\n" +
" new Y().baz();\n" +
" }\n" +
" static void bar(X<Integer> x) {\n" +
" x.counter = new Integer[]{ 0 };\n" +
" System.out.print(Integer.toString(++x.counter[0]));\n" +
" }\n" +
"}\n" +
"\n" +
"class Y extends X<Integer> {\n" +
" Y() {\n" +
" this.counter = new Integer[]{ 0 };\n" +
" }\n" +
" void foo() {\n" +
" System.out.print(Integer.toString(++counter[0]));\n" +
" }\n" +
" void baz() {\n" +
" System.out.println(Integer.toString(++this.counter[0]));\n" +
" }\n" +
"}\n",
},
"111");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 - variation
public void test162() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" static void print(Character c) {\n" +
" System.out.print((char) c);\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" char c = \'H\';\n" +
" print(++c);\n" +
" print(++c);\n" +
" System.out.println(\"done\");\n" +
" }\n" +
"}\n",
},
"IJdone");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 - variation
public void test163() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" char c = \'H\';\n" +
" static void print(Character c) {\n" +
" System.out.print((char) c);\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" X x = new X();\n" +
" print(++x.c);\n" +
" print(++x.c);\n" +
" System.out.println(\"done\");\n" +
" }\n" +
"}\n",
},
"IJdone");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=232565 - variation
public void test164() {
this.runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" static X singleton = new X();\n" +
" static X singleton() { return singleton; }\n" +
" char c = \'H\';\n" +
" \n" +
" static void print(Character c) {\n" +
" System.out.print((char) c);\n" +
" }\n" +
" public static void main(String[] args) {\n" +
" print(++singleton().c);\n" +
" print(++singleton().c);\n" +
" System.out.println(\"done\");\n" +
" }\n" +
"}\n",
},
"IJdone");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231709
public void test165() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" public void foo() {\n" +
" Integer i1 = 10 ;\n" +
" final short s = 100;\n" +
" i1 = s;\n" +
" switch (i1)\n" +
" {\n" +
" case s:\n" +
" }\n" +
" }\n" +
" public void bar() {\n" +
" Integer i2 = 10 ;\n" +
" final byte b = 100;\n" +
" i2 = b;\n" +
" switch (i2)\n" +
" {\n" +
" case b:\n" +
" }\n" +
" } \n" +
" public void baz() {\n" +
" Integer i3 = 10 ;\n" +
" final char c = 100;\n" +
" i3 = c;\n" +
" switch (i3)\n" +
" {\n" +
" case c:\n" +
" }\n" +
" } \n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 3)\n" +
" Integer i1 = 10 ;\n" +
" ^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. ERROR in X.java (at line 5)\n" +
" i1 = s;\n" +
" ^\n" +
"Type mismatch: cannot convert from short to Integer\n" +
"----------\n" +
"3. WARNING in X.java (at line 6)\n" +
" switch (i1)\n" +
" ^^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"4. ERROR in X.java (at line 8)\n" +
" case s:\n" +
" ^\n" +
"Type mismatch: cannot convert from short to Integer\n" +
"----------\n" +
"5. WARNING in X.java (at line 12)\n" +
" Integer i2 = 10 ;\n" +
" ^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"6. ERROR in X.java (at line 14)\n" +
" i2 = b;\n" +
" ^\n" +
"Type mismatch: cannot convert from byte to Integer\n" +
"----------\n" +
"7. WARNING in X.java (at line 15)\n" +
" switch (i2)\n" +
" ^^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"8. ERROR in X.java (at line 17)\n" +
" case b:\n" +
" ^\n" +
"Type mismatch: cannot convert from byte to Integer\n" +
"----------\n" +
"9. WARNING in X.java (at line 21)\n" +
" Integer i3 = 10 ;\n" +
" ^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"10. ERROR in X.java (at line 23)\n" +
" i3 = c;\n" +
" ^\n" +
"Type mismatch: cannot convert from char to Integer\n" +
"----------\n" +
"11. WARNING in X.java (at line 24)\n" +
" switch (i3)\n" +
" ^^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n" +
"12. ERROR in X.java (at line 26)\n" +
" case c:\n" +
" ^\n" +
"Type mismatch: cannot convert from char to Integer\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231709 - variation
public void test166() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" void foo(short s, byte b, char c) {\n" +
" Integer is = s;\n" +
" Integer ib = b;\n" +
" Integer ic = c; \n" +
" }\n" +
" void foo() {\n" +
" final short s = 0;\n" +
" final byte b = 0;\n" +
" final char c = 0;\n" +
" Integer is = s;\n" +
" Integer ib = b;\n" +
" Integer ic = c; \n" +
" }\n" +
" void foo2() {\n" +
" Integer is = (short)0;\n" +
" Integer ib = (byte)0;\n" +
" Integer ic = (char)0; \n" +
" }\n" +
" void foo3() {\n" +
" Short si = 0;\n" +
" Byte bi = 0;\n" +
" Character ci = 0;\n" +
" }\n" +
" void foo4() {\n" +
" Short si = (byte) 0;\n" +
" Byte bi = (short) 0;\n" +
" Character ci = (short) 0;\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" Integer is = s;\n" +
" ^\n" +
"Type mismatch: cannot convert from short to Integer\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
" Integer ib = b;\n" +
" ^\n" +
"Type mismatch: cannot convert from byte to Integer\n" +
"----------\n" +
"3. ERROR in X.java (at line 5)\n" +
" Integer ic = c; \n" +
" ^\n" +
"Type mismatch: cannot convert from char to Integer\n" +
"----------\n" +
"4. ERROR in X.java (at line 11)\n" +
" Integer is = s;\n" +
" ^\n" +
"Type mismatch: cannot convert from short to Integer\n" +
"----------\n" +
"5. ERROR in X.java (at line 12)\n" +
" Integer ib = b;\n" +
" ^\n" +
"Type mismatch: cannot convert from byte to Integer\n" +
"----------\n" +
"6. ERROR in X.java (at line 13)\n" +
" Integer ic = c; \n" +
" ^\n" +
"Type mismatch: cannot convert from char to Integer\n" +
"----------\n" +
"7. ERROR in X.java (at line 16)\n" +
" Integer is = (short)0;\n" +
" ^^^^^^^^\n" +
"Type mismatch: cannot convert from short to Integer\n" +
"----------\n" +
"8. ERROR in X.java (at line 17)\n" +
" Integer ib = (byte)0;\n" +
" ^^^^^^^\n" +
"Type mismatch: cannot convert from byte to Integer\n" +
"----------\n" +
"9. ERROR in X.java (at line 18)\n" +
" Integer ic = (char)0; \n" +
" ^^^^^^^\n" +
"Type mismatch: cannot convert from char to Integer\n" +
"----------\n" +
"10. WARNING in X.java (at line 21)\n" +
" Short si = 0;\n" +
" ^\n" +
"The expression of type int is boxed into Short\n" +
"----------\n" +
"11. WARNING in X.java (at line 22)\n" +
" Byte bi = 0;\n" +
" ^\n" +
"The expression of type int is boxed into Byte\n" +
"----------\n" +
"12. WARNING in X.java (at line 23)\n" +
" Character ci = 0;\n" +
" ^\n" +
"The expression of type int is boxed into Character\n" +
"----------\n" +
"13. WARNING in X.java (at line 26)\n" +
" Short si = (byte) 0;\n" +
" ^^^^^^^^\n" +
"The expression of type byte is boxed into Short\n" +
"----------\n" +
"14. WARNING in X.java (at line 27)\n" +
" Byte bi = (short) 0;\n" +
" ^^^^^^^^^\n" +
"The expression of type short is boxed into Byte\n" +
"----------\n" +
"15. WARNING in X.java (at line 28)\n" +
" Character ci = (short) 0;\n" +
" ^^^^^^^^^\n" +
"The expression of type short is boxed into Character\n" +
"----------\n");
}
public void test167() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" String foo(Comparable<String> x) {\n" +
" System.out.println( \"one\" );" +
" return null;\n" +
" }\n" +
" void foo(int x) {\n" +
" System.out.println( \"two\" );\n" +
" }\n" +
" void bar() {\n" +
" Integer i = 1;\n" +
" String s = foo(i); \n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 9)\n" +
" Integer i = 1;\n" +
" ^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n" +
"2. ERROR in X.java (at line 10)\n" +
" String s = foo(i); \n" +
" ^^^^^^\n" +
"Type mismatch: cannot convert from void to String\n" +
"----------\n" +
"3. WARNING in X.java (at line 10)\n" +
" String s = foo(i); \n" +
" ^\n" +
"The expression of type Integer is unboxed into int\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=264843
public void test168() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X {\n" +
" <T extends Integer> T a() { return 35; }\n" +
" <T extends Integer> T[] b() { return new int[]{35}; }\n" +
" <T extends Integer> T c() { return new Integer(35); }\n" +
" <T extends Integer> T[] d() { return new Integer[]{35}; }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 2)\n" +
" <T extends Integer> T a() { return 35; }\n" +
" ^^^^^^^\n" +
"The type parameter T should not be bounded by the final type Integer. Final types cannot be further extended\n" +
"----------\n" +
"2. ERROR in X.java (at line 2)\n" +
" <T extends Integer> T a() { return 35; }\n" +
" ^^\n" +
"Type mismatch: cannot convert from int to T\n" +
"----------\n" +
"3. WARNING in X.java (at line 3)\n" +
" <T extends Integer> T[] b() { return new int[]{35}; }\n" +
" ^^^^^^^\n" +
"The type parameter T should not be bounded by the final type Integer. Final types cannot be further extended\n" +
"----------\n" +
"4. ERROR in X.java (at line 3)\n" +
" <T extends Integer> T[] b() { return new int[]{35}; }\n" +
" ^^^^^^^^^^^^^\n" +
"Type mismatch: cannot convert from int[] to T[]\n" +
"----------\n" +
"5. WARNING in X.java (at line 4)\n" +
" <T extends Integer> T c() { return new Integer(35); }\n" +
" ^^^^^^^\n" +
"The type parameter T should not be bounded by the final type Integer. Final types cannot be further extended\n" +
"----------\n" +
"6. ERROR in X.java (at line 4)\n" +
" <T extends Integer> T c() { return new Integer(35); }\n" +
" ^^^^^^^^^^^^^^^\n" +
"Type mismatch: cannot convert from Integer to T\n" +
"----------\n" +
"7. WARNING in X.java (at line 5)\n" +
" <T extends Integer> T[] d() { return new Integer[]{35}; }\n" +
" ^^^^^^^\n" +
"The type parameter T should not be bounded by the final type Integer. Final types cannot be further extended\n" +
"----------\n" +
"8. ERROR in X.java (at line 5)\n" +
" <T extends Integer> T[] d() { return new Integer[]{35}; }\n" +
" ^^^^^^^^^^^^^^^^^\n" +
"Type mismatch: cannot convert from Integer[] to T[]\n" +
"----------\n" +
"9. WARNING in X.java (at line 5)\n" +
" <T extends Integer> T[] d() { return new Integer[]{35}; }\n" +
" ^^\n" +
"The expression of type int is boxed into Integer\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=264843
public void test169() {
this.runNegativeTest(
new String[] {
"X.java",
"public class X<T extends Integer> {\n" +
" T x = 12;\n" +
" Byte y = 12;\n" +
" void x(T t) {\n" +
" t = 5;\n" +
" switch (t) {\n" +
" case 1:\n" +
" break;\n" +
" }\n" +
" }\n" +
" void y(Byte t) {\n" +
" t = 5;\n" +
" switch (t) {\n" +
" case 1:\n" +
" break;\n" +
" }\n" +
" }\n" +
"}\n",
},
"----------\n" +
"1. WARNING in X.java (at line 1)\n" +
" public class X<T extends Integer> {\n" +
" ^^^^^^^\n" +
"The type parameter T should not be bounded by the final type Integer. Final types cannot be further extended\n" +
"----------\n" +
"2. ERROR in X.java (at line 2)\n" +
" T x = 12;\n" +
" ^^\n" +
"Type mismatch: cannot convert from int to T\n" +
"----------\n" +
"3. WARNING in X.java (at line 3)\n" +
" Byte y = 12;\n" +
" ^^\n" +
"The expression of type int is boxed into Byte\n" +
"----------\n" +
"4. ERROR in X.java (at line 5)\n" +
" t = 5;\n" +
" ^\n" +
"Type mismatch: cannot convert from int to T\n" +
"----------\n" +
"5. WARNING in X.java (at line 6)\n" +
" switch (t) {\n" +
" ^\n" +
"The expression of type T is unboxed into int\n" +
"----------\n" +
"6. ERROR in X.java (at line 7)\n" +
" case 1:\n" +
" ^\n" +
"Type mismatch: cannot convert from int to T\n" +
"----------\n" +
"7. WARNING in X.java (at line 12)\n" +
" t = 5;\n" +
" ^\n" +
"The expression of type int is boxed into Byte\n" +
"----------\n" +
"8. WARNING in X.java (at line 13)\n" +
" switch (t) {\n" +
" ^\n" +
"The expression of type Byte is unboxed into int\n" +
"----------\n");
}
}
| 149,094
|
Java
|
.java
| 5,152
| 24.823175
| 161
| 0.486735
|
maxeler/eclipse
| 5
| 4
| 3
|
EPL-1.0
|
9/4/2024, 10:35:19 PM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| true
| true
| 149,094
|
4,041,881
|
DefaultMvcResultTests.java
|
deathspeeder_class-guard/spring-framework-3.2.x/spring-test-mvc/src/test/java/org/springframework/test/web/servlet/DefaultMvcResultTests.java
|
/*
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.servlet;
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import javax.servlet.AsyncContext;
import javax.servlet.DispatcherType;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.Part;
import java.io.IOException;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
/**
* Test fixture for {@link DefaultMvcResult}.
*
* @author Rossen Stoyanchev
*/
public class DefaultMvcResultTests {
private DefaultMvcResult mvcResult;
@Before
public void setup() {
ExtendedMockHttpServletRequest request = new ExtendedMockHttpServletRequest();
this.mvcResult = new DefaultMvcResult(request, null);
}
@Test
public void getAsyncResultSuccess() throws Exception {
this.mvcResult.setAsyncResult("Foo");
assertEquals("Foo", this.mvcResult.getAsyncResult());
}
@Test(expected = IllegalStateException.class)
public void getAsyncResultFailure() throws Exception {
this.mvcResult.getAsyncResult(0);
}
private static class ExtendedMockHttpServletRequest extends MockHttpServletRequest {
private AsyncContext asyncContext;
public ExtendedMockHttpServletRequest() {
this.asyncContext = mock(AsyncContext.class);
given(this.asyncContext.getTimeout()).willReturn(0L);
}
@Override
public boolean isAsyncStarted() {
return true;
}
@Override
public AsyncContext getAsyncContext() {
return this.asyncContext;
}
@Override
public Collection<Part> getParts() throws IOException, ServletException {
return null;
}
@Override
public Part getPart(String name) throws IOException, ServletException {
return null;
}
@Override
public AsyncContext startAsync() throws IllegalStateException {
return this.asyncContext;
}
@Override
public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) {
return this.asyncContext;
}
@Override
public boolean isAsyncSupported() {
return true;
}
@Override
public DispatcherType getDispatcherType() {
return null;
}
}
}
| 2,891
|
Java
|
.java
| 91
| 29.164835
| 98
| 0.795896
|
deathspeeder/class-guard
| 2
| 2
| 0
|
GPL-2.0
|
9/5/2024, 12:00:55 AM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 2,891
|
2,942,732
|
LongOpTag.java
|
MIT-PAC_obj-sens-soot/src/soot/dexpler/tags/LongOpTag.java
|
//
// (c) 2012 University of Luxembourg - Interdisciplinary Centre for
// Security Reliability and Trust (SnT) - All rights reserved
//
// Author: Alexandre Bartel
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package soot.dexpler.tags;
import soot.tagkit.Tag;
public class LongOpTag implements Tag {
public String getName() {
return "LongOpTag";
}
public byte[] getValue () {
byte[] b = new byte[1];
b[0] = 0;
return b;
}
}
| 1,052
|
Java
|
.java
| 31
| 32.258065
| 73
| 0.744828
|
MIT-PAC/obj-sens-soot
| 5
| 1
| 0
|
LGPL-2.1
|
9/4/2024, 10:36:36 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 1,052
|
1,701,306
|
ListDirectoryTask.java
|
stacksync_android/src/main/java/com/stacksync/android/task/ListDirectoryTask.java
|
package com.stacksync.android.task;
import java.util.Date;
import java.util.logging.Logger;
import org.apache.http.conn.ConnectTimeoutException;
import android.content.Context;
import android.util.Log;
import com.stacksync.android.MainActivity;
import com.stacksync.android.StacksyncApp;
import com.stacksync.android.api.ListResponse;
import com.stacksync.android.api.StacksyncClient;
import com.stacksync.android.cache.CachedFile;
import com.stacksync.android.exceptions.APIException;
public class ListDirectoryTask extends MyAsyncTask<String, Integer, ListResponse> {
// private ProgressDialog progressBar;
private static String TAG = "ListDirectoryTask";
private String fileId;
public ListDirectoryTask(Context context) {
super(context);
}
@Override
protected void onPostExecute(ListResponse result) {
if (result.getSucced()) {
String metadata = result.getMetadata().toString();
String lastModified = new Date().toString();
Long size = 0L;
Long version = 0L; // FIXME: get the real version
String name = ""; // FIXME: get the real name
String localPath = "";
CachedFile cachedFile = new CachedFile(fileId, name, version, size, lastModified, metadata, localPath);
getCacheManager().saveFileToCache(cachedFile);
}
((MainActivity) getContext()).onReceiveListResponse(result);
}
@Override
protected void onPreExecute() {
}
@Override
protected ListResponse doInBackground(String... params) {
fileId = params[0];
StacksyncClient client = StacksyncApp.getClient(getContext());
ListResponse result;
try {
boolean retry = true;
result = client.listDirectory(fileId, retry);
} catch (APIException e) {
Log.e(TAG, e.getMessage(), e);
result = new ListResponse();
result.setSucced(false);
result.setStatusCode(e.getStatusCode());
result.setMessage(e.getMessage());
} catch (ConnectTimeoutException e){
Log.e(TAG, e.getMessage(), e);
result = new ListResponse();
result.setSucced(false);
result.setMessage("Could not connect to service");
} catch (Exception e) {
Log.e(TAG, "error", e);
result = new ListResponse();
result.setSucced(false);
if (e == null) {
// for some unknown reason sometimes the exception is null...
result.setMessage("Unknown error");
} else if (e.getMessage() == null) {
result.setMessage(e.toString());
} else {
result.setMessage(e.getMessage());
}
}
return result;
}
protected void onProgressUpdate(Integer... progress) {
// progressBar.setProgress(progress[0]);
}
@Override
public void setProgress(int value) {
// TODO Auto-generated method stub
}
}
| 2,636
|
Java
|
.java
| 78
| 30.602564
| 106
| 0.748224
|
stacksync/android
| 13
| 5
| 9
|
GPL-3.0
|
9/4/2024, 8:15:17 PM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| false
| true
| 2,636
|
1,316,300
|
B.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractInterface/test74/in/B.java
|
package p;
public class B implements OldInterface{
private void s(){
OldInterface i;
i= find();
}
private A find(){
return new A();
}
}
| 147
|
Java
|
.java
| 10
| 12.6
| 39
| 0.691176
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 147
|
5,106,901
|
WebSocketListener.java
|
amaralDaniel_megaphone/Megaphone/async-http-client-master/client/src/main/java/org/asynchttpclient/ws/WebSocketListener.java
|
/*
* Copyright (c) 2010-2012 Sonatype, Inc. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/
package org.asynchttpclient.ws;
/**
* A generic {@link WebSocketListener} for WebSocket events. Use the appropriate listener for receiving message bytes.
*/
public interface WebSocketListener {
/**
* Invoked when the {@link WebSocket} is open.
*
* @param websocket the WebSocket
*/
void onOpen(WebSocket websocket);
/**
* Invoked when the {@link WebSocket} is close.
*
* @param websocket the WebSocket
*/
void onClose(WebSocket websocket);
/**
* Invoked when the {@link WebSocket} is open.
*
* @param t a {@link Throwable}
*/
void onError(Throwable t);
}
| 1,341
|
Java
|
.java
| 36
| 33.444444
| 118
| 0.717141
|
amaralDaniel/megaphone
| 1
| 0
| 0
|
GPL-3.0
|
9/5/2024, 12:41:38 AM (Europe/Amsterdam)
| true
| true
| true
| true
| true
| true
| true
| true
| 1,341
|
4,948,026
|
CustomerAgingReportDataHolder.java
|
ua-eas_ua-kfs-5_3/work/src/org/kuali/kfs/module/ar/report/util/CustomerAgingReportDataHolder.java
|
/*
* The Kuali Financial System, a comprehensive financial management system for higher education.
*
* Copyright 2005-2014 The Kuali Foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.kuali.kfs.module.ar.report.util;
import java.util.Map;
import org.kuali.rice.core.api.util.type.KualiDecimal;
/**
* This class...
*/
public class CustomerAgingReportDataHolder {
private Map<String, Object> knownCustomers;
private KualiDecimal total0to30;
private KualiDecimal total31to60;
private KualiDecimal total61to90;
private KualiDecimal total91toSYSPR;
private KualiDecimal totalSYSPRplus1orMore;
private KualiDecimal totalAmountDue;
/**
* Gets the knownCustomers attribute.
* @return Returns the knownCustomers.
*/
public Map<String, Object> getKnownCustomers() {
return knownCustomers;
}
/**
* Sets the knownCustomers attribute value.
* @param knownCustomers The knownCustomers to set.
*/
public void setKnownCustomers(Map<String, Object> knownCustomers) {
this.knownCustomers = knownCustomers;
}
/**
* Gets the total0to30 attribute.
* @return Returns the total0to30.
*/
public KualiDecimal getTotal0to30() {
return total0to30;
}
/**
* Sets the total0to30 attribute value.
* @param total0to30 The total0to30 to set.
*/
public void setTotal0to30(KualiDecimal total0to30) {
this.total0to30 = total0to30;
}
/**
* Gets the total31to60 attribute.
* @return Returns the total31to60.
*/
public KualiDecimal getTotal31to60() {
return total31to60;
}
/**
* Sets the total31to60 attribute value.
* @param total31to60 The total31to60 to set.
*/
public void setTotal31to60(KualiDecimal total31to60) {
this.total31to60 = total31to60;
}
/**
* Gets the total61to90 attribute.
* @return Returns the total61to90.
*/
public KualiDecimal getTotal61to90() {
return total61to90;
}
/**
* Sets the total61to90 attribute value.
* @param total61to90 The total61to90 to set.
*/
public void setTotal61to90(KualiDecimal total61to90) {
this.total61to90 = total61to90;
}
/**
* Gets the total91toSYSPR attribute.
* @return Returns the total91toSYSPR.
*/
public KualiDecimal getTotal91toSYSPR() {
return total91toSYSPR;
}
/**
* Sets the total91toSYSPR attribute value.
* @param total91toSYSPR The total91toSYSPR to set.
*/
public void setTotal91toSYSPR(KualiDecimal total91toSYSPR) {
this.total91toSYSPR = total91toSYSPR;
}
/**
* Gets the totalSYSPRplus1orMore attribute.
* @return Returns the totalSYSPRplus1orMore.
*/
public KualiDecimal getTotalSYSPRplus1orMore() {
return totalSYSPRplus1orMore;
}
/**
* Sets the totalSYSPRplus1orMore attribute value.
* @param totalSYSPRplus1orMore The totalSYSPRplus1orMore to set.
*/
public void setTotalSYSPRplus1orMore(KualiDecimal totalSYSPRplus1orMore) {
this.totalSYSPRplus1orMore = totalSYSPRplus1orMore;
}
/**
* Gets the totalAmountDue attribute.
* @return Returns the totalAmountDue.
*/
public KualiDecimal getTotalAmountDue() {
return totalAmountDue;
}
/**
* Sets the totalAmountDue attribute value.
* @param totalAmountDue The totalAmountDue to set.
*/
public void setTotalAmountDue(KualiDecimal totalAmountDue) {
this.totalAmountDue = totalAmountDue;
}
/**
*
* This method clears all the amount fields and resets them to zero.
*/
public void clearAllAmounts() {
this.total0to30 = KualiDecimal.ZERO;
this.total31to60 = KualiDecimal.ZERO;
this.total61to90 = KualiDecimal.ZERO;
this.total91toSYSPR = KualiDecimal.ZERO;
this.totalSYSPRplus1orMore = KualiDecimal.ZERO;
this.totalAmountDue = KualiDecimal.ZERO;
}
}
| 4,828
|
Java
|
.java
| 143
| 27.328671
| 97
| 0.680428
|
ua-eas/ua-kfs-5.3
| 1
| 0
| 0
|
AGPL-3.0
|
9/5/2024, 12:36:54 AM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| false
| true
| 4,828
|
1,318,085
|
A_test8_out.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractConstant/canExtract/A_test8_out.java
|
//8, 16 -> 8, 22 AllowLoadtime == true
package p;
class S {
static int s;
private static final int CONSTANT= 23 * s;
int f() {
return CONSTANT;
}
}
| 157
|
Java
|
.java
| 9
| 15.666667
| 43
| 0.659864
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 157
|
2,400,566
|
Tester.java
|
Certseeds_CS309-OOAD/Factory/SimpleFactory/Tester.java
|
package SimpleFactory;
public class Tester extends personInfo implements ITStaff{
private int level;
public Tester(){
super("Tester","123456");
super.setStartingSalary(8000);
this.level=(int)(Math.random()*5+1);
}
@Override
public String working() {
return "Testing";
}
@Override
public int getSalary() {
return super.getStartingSalary()+level*1500;
}
public String toString(){
return String.format("%-12sname: %-15s, salary: %5d", working(),this.getName(),this.getSalary());
}
}
| 509
|
Java
|
.java
| 20
| 23
| 99
| 0.73499
|
Certseeds/CS309-OOAD
| 8
| 2
| 0
|
AGPL-3.0
|
9/4/2024, 9:20:24 PM (Europe/Amsterdam)
| false
| false
| false
| true
| false
| false
| true
| true
| 509
|
4,043,016
|
Spr3264SingleSpringContextTests.java
|
deathspeeder_class-guard/spring-framework-3.2.x/spring-test/src/test/java/org/springframework/test/Spr3264SingleSpringContextTests.java
|
/*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test;
/**
* JUnit 3.8 based unit test which verifies new functionality requested in <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-3264"
* target="_blank">SPR-3264</a>.
*
* @author Sam Brannen
* @since 2.5
* @see Spr3264DependencyInjectionSpringContextTests
*/
@SuppressWarnings("deprecation")
public class Spr3264SingleSpringContextTests extends AbstractSingleSpringContextTests {
public Spr3264SingleSpringContextTests() {
super();
}
public Spr3264SingleSpringContextTests(String name) {
super(name);
}
/**
* <p>
* Test which addresses the following issue raised in SPR-3264:
* </p>
* <p>
* AbstractSingleSpringContextTests always expects an application context to
* be created even if no files/locations are specified which can lead to NPE
* problems or force an appCtx to be instantiated even if not needed.
* </p>
*/
public void testApplicationContextNotAutoCreated() {
assertNull("The ApplicationContext should NOT be automatically created if no 'locations' are defined.",
super.applicationContext);
assertEquals("Verifying the ApplicationContext load count.", 0, super.getLoadCount());
}
}
| 1,819
|
Java
|
.java
| 49
| 34.816327
| 105
| 0.770408
|
deathspeeder/class-guard
| 2
| 2
| 0
|
GPL-2.0
|
9/5/2024, 12:00:55 AM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 1,819
|
3,234,295
|
DSSException.java
|
linagora_linsign/linsign-dss/dss-webservices-client/src/main/java/eu/europa/esig/dss/wsclient/signature/DSSException.java
|
/**
* DSS - Digital Signature Services
* Copyright (C) 2015 European Commission, provided under the CEF programme
*
* This file is part of the "DSS - Digital Signature Services" project.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package eu.europa.esig.dss.wsclient.signature;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
*
*
*
*
* <pre>
* <complexType name="DSSException">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DSSException", propOrder = {
"message"
})
public class DSSException {
protected String message;
/**
* Gets the value of the message property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMessage() {
return message;
}
/**
* Sets the value of the message property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMessage(String value) {
this.message = value;
}
}
| 2,158
|
Java
|
.java
| 72
| 26.5
| 101
| 0.681578
|
linagora/linsign
| 4
| 2
| 1
|
AGPL-3.0
|
9/4/2024, 11:07:08 PM (Europe/Amsterdam)
| false
| true
| false
| true
| false
| true
| true
| true
| 2,158
|
2,440,333
|
DataScope.java
|
chenzhitao_mall/mall-admin-server/jmshop-system/src/main/java/co/yixiang/config/DataScope.java
|
package co.yixiang.config;
import co.yixiang.modules.system.service.UserService;
import co.yixiang.modules.system.service.dto.RoleSmallDTO;
import co.yixiang.modules.system.service.dto.UserDTO;
import co.yixiang.utils.SecurityUtils;
import co.yixiang.modules.system.domain.Dept;
import co.yixiang.modules.system.service.DeptService;
import co.yixiang.modules.system.service.RoleService;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 数据权限配置
* @author Zheng Jie
* @date 2019-4-1
*/
@Component
public class DataScope {
private final String[] scopeType = {"全部","本级","自定义"};
private final UserService userService;
private final RoleService roleService;
private final DeptService deptService;
public DataScope(UserService userService, RoleService roleService, DeptService deptService) {
this.userService = userService;
this.roleService = roleService;
this.deptService = deptService;
}
public Set<Long> getDeptIds() {
UserDTO user = userService.findByName(SecurityUtils.getUsername());
// 用于存储部门id
Set<Long> deptIds = new HashSet<>();
// 查询用户角色
List<RoleSmallDTO> roleSet = roleService.findByUsersId(user.getId());
for (RoleSmallDTO role : roleSet) {
if (scopeType[0].equals(role.getDataScope())) {
return new HashSet<>() ;
}
// 存储本级的数据权限
if (scopeType[1].equals(role.getDataScope())) {
deptIds.add(user.getDept().getId());
}
// 存储自定义的数据权限
if (scopeType[2].equals(role.getDataScope())) {
Set<Dept> depts = deptService.findByRoleIds(role.getId());
for (Dept dept : depts) {
deptIds.add(dept.getId());
List<Dept> deptChildren = deptService.findByPid(dept.getId());
if (deptChildren != null && deptChildren.size() != 0) {
deptIds.addAll(getDeptChildren(deptChildren));
}
}
}
}
return deptIds;
}
public List<Long> getDeptChildren(List<Dept> deptList) {
List<Long> list = new ArrayList<>();
deptList.forEach(dept -> {
if (dept!=null && dept.getEnabled()){
List<Dept> depts = deptService.findByPid(dept.getId());
if(deptList.size() != 0){
list.addAll(getDeptChildren(depts));
}
list.add(dept.getId());
}
}
);
return list;
}
}
| 2,850
|
Java
|
.java
| 72
| 28.458333
| 97
| 0.600823
|
chenzhitao/mall
| 8
| 4
| 0
|
GPL-3.0
|
9/4/2024, 9:26:13 PM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| false
| true
| true
| 2,762
|
994,243
|
Favorite.java
|
bizzancoin_btc-eth-fil-contract-Exchange---ztuo/android/app/src/main/java/com/bizzan/entity/Favorite.java
|
package com.bizzan.entity;
/**
* Created by Administrator on 2018/2/25.
*/
public class Favorite {
private int id;
private String symbol;
private int memberId;
private String addTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public int getMemberId() {
return memberId;
}
public void setMemberId(int memberId) {
this.memberId = memberId;
}
public String getAddTime() {
return addTime;
}
public void setAddTime(String addTime) {
this.addTime = addTime;
}
}
| 756
|
Java
|
.java
| 34
| 16.647059
| 44
| 0.622191
|
bizzancoin/btc-eth-fil-contract-Exchange---ztuo
| 52
| 68
| 5
|
AGPL-3.0
|
9/4/2024, 7:10:22 PM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| false
| true
| true
| 756
|
4,802,963
|
ServiceRegistrationException.java
|
empeeoh_bluecove-osx/src/main/java/javax/bluetooth/ServiceRegistrationException.java
|
/**
* BlueCove - Java library for Bluetooth
*
* Java docs licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* (c) Copyright 2001, 2002 Motorola, Inc. ALL RIGHTS RESERVED.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* @version $Id: ServiceRegistrationException.java 2471 2008-12-01 03:44:20Z skarzhevskyy $
*/
package javax.bluetooth;
import java.io.IOException;
/**
* The {@code ServiceRegistrationException} is thrown when there is a failure
* to add a service record to the local Service Discovery Database (SDDB) or
* to modify an existing service record in the SDDB. The failure could be
* because the SDDB has no room for new records or because the modification
* being attempted to a service record violated one of the rules about service
* record updates. This exception will also be thrown if it was not possible
* to obtain an RFCOMM server channel needed for a {@code btspp} service record.
*
*/
public class ServiceRegistrationException extends IOException {
private static final long serialVersionUID = 1L;
/**
* Creates a {@code ServiceRegistrationException} without a detailed message.
*
*/
public ServiceRegistrationException() {
super();
}
/**
* Creates a {@code ServiceRegistrationException} with a detailed message.
* @param msg the reason for the exception
*/
public ServiceRegistrationException(String msg) {
super(msg);
}
}
| 2,228
|
Java
|
.java
| 55
| 38.145455
| 92
| 0.758191
|
empeeoh/bluecove-osx
| 1
| 6
| 0
|
LGPL-2.1
|
9/5/2024, 12:32:31 AM (Europe/Amsterdam)
| false
| true
| true
| true
| true
| true
| true
| true
| 2,228
|
3,680,030
|
getTail.java
|
ingelabs_mauve/gnu/testlet/java/util/logging/XMLFormatter/getTail.java
|
// Tags: JDK1.4
// Copyright (C) 2004 Sascha Brawer <[email protected]>
// This file is part of Mauve.
// Mauve is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
// Mauve is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Mauve; see the file COPYING. If not, write to
// the Free Software Foundation, 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
package gnu.testlet.java.util.logging.XMLFormatter;
import gnu.testlet.Testlet;
import gnu.testlet.TestHarness;
import java.util.logging.StreamHandler;
import java.util.logging.XMLFormatter;
/**
* @author <a href="mailto:[email protected]">Sascha Brawer</a>
*/
public class getTail
implements Testlet
{
public void test(TestHarness h)
{
XMLFormatter formatter = new XMLFormatter();
StreamHandler handler = new StreamHandler();
// Check #1.
h.check(formatter.getTail(handler),
"</log>" + System.getProperty("line.separator"));
/* Check #2.
*
* The behavior of passing null is not specified, but
* we want to check that we do the same as Sun's reference
* implementation.
*/
try
{
formatter.getTail(null);
h.check(true);
}
catch (Exception ex)
{
h.check(false);
}
}
}
| 1,697
|
Java
|
.java
| 50
| 30.26
| 71
| 0.712714
|
ingelabs/mauve
| 3
| 2
| 0
|
GPL-2.0
|
9/4/2024, 11:38:21 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 1,697
|
4,174,303
|
DormandPrince853StepInterpolator.java
|
andryr_symja/symja_android_library/commons-math/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolator.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.math4.ode.nonstiff;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import org.apache.commons.math4.exception.MaxCountExceededException;
import org.apache.commons.math4.ode.AbstractIntegrator;
import org.apache.commons.math4.ode.EquationsMapper;
import org.apache.commons.math4.ode.sampling.StepInterpolator;
/**
* This class represents an interpolator over the last step during an
* ODE integration for the 8(5,3) Dormand-Prince integrator.
*
* @see DormandPrince853Integrator
*
* @since 1.2
*/
class DormandPrince853StepInterpolator
extends RungeKuttaStepInterpolator {
/** Serializable version identifier. */
private static final long serialVersionUID = 20111120L;
/** Propagation weights, element 1. */
private static final double B_01 = 104257.0 / 1920240.0;
// elements 2 to 5 are zero, so they are neither stored nor used
/** Propagation weights, element 6. */
private static final double B_06 = 3399327.0 / 763840.0;
/** Propagation weights, element 7. */
private static final double B_07 = 66578432.0 / 35198415.0;
/** Propagation weights, element 8. */
private static final double B_08 = -1674902723.0 / 288716400.0;
/** Propagation weights, element 9. */
private static final double B_09 = 54980371265625.0 / 176692375811392.0;
/** Propagation weights, element 10. */
private static final double B_10 = -734375.0 / 4826304.0;
/** Propagation weights, element 11. */
private static final double B_11 = 171414593.0 / 851261400.0;
/** Propagation weights, element 12. */
private static final double B_12 = 137909.0 / 3084480.0;
/** Time step for stage 14 (interpolation only). */
private static final double C14 = 1.0 / 10.0;
/** Internal weights for stage 14, element 1. */
private static final double K14_01 = 13481885573.0 / 240030000000.0 - B_01;
// elements 2 to 5 are zero, so they are neither stored nor used
/** Internal weights for stage 14, element 6. */
private static final double K14_06 = 0.0 - B_06;
/** Internal weights for stage 14, element 7. */
private static final double K14_07 = 139418837528.0 / 549975234375.0 - B_07;
/** Internal weights for stage 14, element 8. */
private static final double K14_08 = -11108320068443.0 / 45111937500000.0 - B_08;
/** Internal weights for stage 14, element 9. */
private static final double K14_09 = -1769651421925959.0 / 14249385146080000.0 - B_09;
/** Internal weights for stage 14, element 10. */
private static final double K14_10 = 57799439.0 / 377055000.0 - B_10;
/** Internal weights for stage 14, element 11. */
private static final double K14_11 = 793322643029.0 / 96734250000000.0 - B_11;
/** Internal weights for stage 14, element 12. */
private static final double K14_12 = 1458939311.0 / 192780000000.0 - B_12;
/** Internal weights for stage 14, element 13. */
private static final double K14_13 = -4149.0 / 500000.0;
/** Time step for stage 15 (interpolation only). */
private static final double C15 = 1.0 / 5.0;
/** Internal weights for stage 15, element 1. */
private static final double K15_01 = 1595561272731.0 / 50120273500000.0 - B_01;
// elements 2 to 5 are zero, so they are neither stored nor used
/** Internal weights for stage 15, element 6. */
private static final double K15_06 = 975183916491.0 / 34457688031250.0 - B_06;
/** Internal weights for stage 15, element 7. */
private static final double K15_07 = 38492013932672.0 / 718912673015625.0 - B_07;
/** Internal weights for stage 15, element 8. */
private static final double K15_08 = -1114881286517557.0 / 20298710767500000.0 - B_08;
/** Internal weights for stage 15, element 9. */
private static final double K15_09 = 0.0 - B_09;
/** Internal weights for stage 15, element 10. */
private static final double K15_10 = 0.0 - B_10;
/** Internal weights for stage 15, element 11. */
private static final double K15_11 = -2538710946863.0 / 23431227861250000.0 - B_11;
/** Internal weights for stage 15, element 12. */
private static final double K15_12 = 8824659001.0 / 23066716781250.0 - B_12;
/** Internal weights for stage 15, element 13. */
private static final double K15_13 = -11518334563.0 / 33831184612500.0;
/** Internal weights for stage 15, element 14. */
private static final double K15_14 = 1912306948.0 / 13532473845.0;
/** Time step for stage 16 (interpolation only). */
private static final double C16 = 7.0 / 9.0;
/** Internal weights for stage 16, element 1. */
private static final double K16_01 = -13613986967.0 / 31741908048.0 - B_01;
// elements 2 to 5 are zero, so they are neither stored nor used
/** Internal weights for stage 16, element 6. */
private static final double K16_06 = -4755612631.0 / 1012344804.0 - B_06;
/** Internal weights for stage 16, element 7. */
private static final double K16_07 = 42939257944576.0 / 5588559685701.0 - B_07;
/** Internal weights for stage 16, element 8. */
private static final double K16_08 = 77881972900277.0 / 19140370552944.0 - B_08;
/** Internal weights for stage 16, element 9. */
private static final double K16_09 = 22719829234375.0 / 63689648654052.0 - B_09;
/** Internal weights for stage 16, element 10. */
private static final double K16_10 = 0.0 - B_10;
/** Internal weights for stage 16, element 11. */
private static final double K16_11 = 0.0 - B_11;
/** Internal weights for stage 16, element 12. */
private static final double K16_12 = 0.0 - B_12;
/** Internal weights for stage 16, element 13. */
private static final double K16_13 = -1199007803.0 / 857031517296.0;
/** Internal weights for stage 16, element 14. */
private static final double K16_14 = 157882067000.0 / 53564469831.0;
/** Internal weights for stage 16, element 15. */
private static final double K16_15 = -290468882375.0 / 31741908048.0;
/** Interpolation weights.
* (beware that only the non-null values are in the table)
*/
private static final double[][] D = {
{ -17751989329.0 / 2106076560.0, 4272954039.0 / 7539864640.0,
-118476319744.0 / 38604839385.0, 755123450731.0 / 316657731600.0,
3692384461234828125.0 / 1744130441634250432.0, -4612609375.0 / 5293382976.0,
2091772278379.0 / 933644586600.0, 2136624137.0 / 3382989120.0,
-126493.0 / 1421424.0, 98350000.0 / 5419179.0,
-18878125.0 / 2053168.0, -1944542619.0 / 438351368.0},
{ 32941697297.0 / 3159114840.0, 456696183123.0 / 1884966160.0,
19132610714624.0 / 115814518155.0, -177904688592943.0 / 474986597400.0,
-4821139941836765625.0 / 218016305204281304.0, 30702015625.0 / 3970037232.0,
-85916079474274.0 / 2800933759800.0, -5919468007.0 / 634310460.0,
2479159.0 / 157936.0, -18750000.0 / 602131.0,
-19203125.0 / 2053168.0, 15700361463.0 / 438351368.0},
{ 12627015655.0 / 631822968.0, -72955222965.0 / 188496616.0,
-13145744952320.0 / 69488710893.0, 30084216194513.0 / 56998391688.0,
-296858761006640625.0 / 25648977082856624.0, 569140625.0 / 82709109.0,
-18684190637.0 / 18672891732.0, 69644045.0 / 89549712.0,
-11847025.0 / 4264272.0, -978650000.0 / 16257537.0,
519371875.0 / 6159504.0, 5256837225.0 / 438351368.0},
{ -450944925.0 / 17550638.0, -14532122925.0 / 94248308.0,
-595876966400.0 / 2573655959.0, 188748653015.0 / 527762886.0,
2545485458115234375.0 / 27252038150535163.0, -1376953125.0 / 36759604.0,
53995596795.0 / 518691437.0, 210311225.0 / 7047894.0,
-1718875.0 / 39484.0, 58000000.0 / 602131.0,
-1546875.0 / 39484.0, -1262172375.0 / 8429834.0}
};
/** Last evaluations. */
private double[][] yDotKLast;
/** Vectors for interpolation. */
private double[][] v;
/** Initialization indicator for the interpolation vectors. */
private boolean vectorsInitialized;
/** Simple constructor.
* This constructor builds an instance that is not usable yet, the
* {@link #reinitialize} method should be called before using the
* instance in order to initialize the internal arrays. This
* constructor is used only in order to delay the initialization in
* some cases. The {@link EmbeddedRungeKuttaIntegrator} uses the
* prototyping design pattern to create the step interpolators by
* cloning an uninitialized model and latter initializing the copy.
*/
// CHECKSTYLE: stop RedundantModifier
// the public modifier here is needed for serialization
public DormandPrince853StepInterpolator() {
super();
yDotKLast = null;
v = null;
vectorsInitialized = false;
}
// CHECKSTYLE: resume RedundantModifier
/** Copy constructor.
* @param interpolator interpolator to copy from. The copy is a deep
* copy: its arrays are separated from the original arrays of the
* instance
*/
DormandPrince853StepInterpolator(final DormandPrince853StepInterpolator interpolator) {
super(interpolator);
if (interpolator.currentState == null) {
yDotKLast = null;
v = null;
vectorsInitialized = false;
} else {
final int dimension = interpolator.currentState.length;
yDotKLast = new double[3][];
for (int k = 0; k < yDotKLast.length; ++k) {
yDotKLast[k] = new double[dimension];
System.arraycopy(interpolator.yDotKLast[k], 0, yDotKLast[k], 0,
dimension);
}
v = new double[7][];
for (int k = 0; k < v.length; ++k) {
v[k] = new double[dimension];
System.arraycopy(interpolator.v[k], 0, v[k], 0, dimension);
}
vectorsInitialized = interpolator.vectorsInitialized;
}
}
/** {@inheritDoc} */
@Override
protected StepInterpolator doCopy() {
return new DormandPrince853StepInterpolator(this);
}
/** {@inheritDoc} */
@Override
public void reinitialize(final AbstractIntegrator integrator,
final double[] y, final double[][] yDotK, final boolean forward,
final EquationsMapper primaryMapper,
final EquationsMapper[] secondaryMappers) {
super.reinitialize(integrator, y, yDotK, forward, primaryMapper, secondaryMappers);
final int dimension = currentState.length;
yDotKLast = new double[3][];
for (int k = 0; k < yDotKLast.length; ++k) {
yDotKLast[k] = new double[dimension];
}
v = new double[7][];
for (int k = 0; k < v.length; ++k) {
v[k] = new double[dimension];
}
vectorsInitialized = false;
}
/** {@inheritDoc} */
@Override
public void storeTime(final double t) {
super.storeTime(t);
vectorsInitialized = false;
}
/** {@inheritDoc} */
@Override
protected void computeInterpolatedStateAndDerivatives(final double theta,
final double oneMinusThetaH)
throws MaxCountExceededException {
if (! vectorsInitialized) {
if (v == null) {
v = new double[7][];
for (int k = 0; k < 7; ++k) {
v[k] = new double[interpolatedState.length];
}
}
// perform the last evaluations if they have not been done yet
finalizeStep();
// compute the interpolation vectors for this time step
for (int i = 0; i < interpolatedState.length; ++i) {
final double yDot1 = yDotK[0][i];
final double yDot6 = yDotK[5][i];
final double yDot7 = yDotK[6][i];
final double yDot8 = yDotK[7][i];
final double yDot9 = yDotK[8][i];
final double yDot10 = yDotK[9][i];
final double yDot11 = yDotK[10][i];
final double yDot12 = yDotK[11][i];
final double yDot13 = yDotK[12][i];
final double yDot14 = yDotKLast[0][i];
final double yDot15 = yDotKLast[1][i];
final double yDot16 = yDotKLast[2][i];
v[0][i] = B_01 * yDot1 + B_06 * yDot6 + B_07 * yDot7 +
B_08 * yDot8 + B_09 * yDot9 + B_10 * yDot10 +
B_11 * yDot11 + B_12 * yDot12;
v[1][i] = yDot1 - v[0][i];
v[2][i] = v[0][i] - v[1][i] - yDotK[12][i];
for (int k = 0; k < D.length; ++k) {
v[k+3][i] = D[k][0] * yDot1 + D[k][1] * yDot6 + D[k][2] * yDot7 +
D[k][3] * yDot8 + D[k][4] * yDot9 + D[k][5] * yDot10 +
D[k][6] * yDot11 + D[k][7] * yDot12 + D[k][8] * yDot13 +
D[k][9] * yDot14 + D[k][10] * yDot15 + D[k][11] * yDot16;
}
}
vectorsInitialized = true;
}
final double eta = 1 - theta;
final double twoTheta = 2 * theta;
final double theta2 = theta * theta;
final double dot1 = 1 - twoTheta;
final double dot2 = theta * (2 - 3 * theta);
final double dot3 = twoTheta * (1 + theta * (twoTheta -3));
final double dot4 = theta2 * (3 + theta * (5 * theta - 8));
final double dot5 = theta2 * (3 + theta * (-12 + theta * (15 - 6 * theta)));
final double dot6 = theta2 * theta * (4 + theta * (-15 + theta * (18 - 7 * theta)));
if ((previousState != null) && (theta <= 0.5)) {
for (int i = 0; i < interpolatedState.length; ++i) {
interpolatedState[i] = previousState[i] +
theta * h * (v[0][i] +
eta * (v[1][i] +
theta * (v[2][i] +
eta * (v[3][i] +
theta * (v[4][i] +
eta * (v[5][i] +
theta * (v[6][i])))))));
interpolatedDerivatives[i] = v[0][i] + dot1 * v[1][i] + dot2 * v[2][i] +
dot3 * v[3][i] + dot4 * v[4][i] +
dot5 * v[5][i] + dot6 * v[6][i];
}
} else {
for (int i = 0; i < interpolatedState.length; ++i) {
interpolatedState[i] = currentState[i] -
oneMinusThetaH * (v[0][i] -
theta * (v[1][i] +
theta * (v[2][i] +
eta * (v[3][i] +
theta * (v[4][i] +
eta * (v[5][i] +
theta * (v[6][i])))))));
interpolatedDerivatives[i] = v[0][i] + dot1 * v[1][i] + dot2 * v[2][i] +
dot3 * v[3][i] + dot4 * v[4][i] +
dot5 * v[5][i] + dot6 * v[6][i];
}
}
}
/** {@inheritDoc} */
@Override
protected void doFinalize() throws MaxCountExceededException {
if (currentState == null) {
// we are finalizing an uninitialized instance
return;
}
double s;
final double[] yTmp = new double[currentState.length];
final double pT = getGlobalPreviousTime();
// k14
for (int j = 0; j < currentState.length; ++j) {
s = K14_01 * yDotK[0][j] + K14_06 * yDotK[5][j] + K14_07 * yDotK[6][j] +
K14_08 * yDotK[7][j] + K14_09 * yDotK[8][j] + K14_10 * yDotK[9][j] +
K14_11 * yDotK[10][j] + K14_12 * yDotK[11][j] + K14_13 * yDotK[12][j];
yTmp[j] = currentState[j] + h * s;
}
integrator.computeDerivatives(pT + C14 * h, yTmp, yDotKLast[0]);
// k15
for (int j = 0; j < currentState.length; ++j) {
s = K15_01 * yDotK[0][j] + K15_06 * yDotK[5][j] + K15_07 * yDotK[6][j] +
K15_08 * yDotK[7][j] + K15_09 * yDotK[8][j] + K15_10 * yDotK[9][j] +
K15_11 * yDotK[10][j] + K15_12 * yDotK[11][j] + K15_13 * yDotK[12][j] +
K15_14 * yDotKLast[0][j];
yTmp[j] = currentState[j] + h * s;
}
integrator.computeDerivatives(pT + C15 * h, yTmp, yDotKLast[1]);
// k16
for (int j = 0; j < currentState.length; ++j) {
s = K16_01 * yDotK[0][j] + K16_06 * yDotK[5][j] + K16_07 * yDotK[6][j] +
K16_08 * yDotK[7][j] + K16_09 * yDotK[8][j] + K16_10 * yDotK[9][j] +
K16_11 * yDotK[10][j] + K16_12 * yDotK[11][j] + K16_13 * yDotK[12][j] +
K16_14 * yDotKLast[0][j] + K16_15 * yDotKLast[1][j];
yTmp[j] = currentState[j] + h * s;
}
integrator.computeDerivatives(pT + C16 * h, yTmp, yDotKLast[2]);
}
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
throws IOException {
try {
// save the local attributes
finalizeStep();
} catch (MaxCountExceededException mcee) {
final IOException ioe = new IOException(mcee.getLocalizedMessage());
ioe.initCause(mcee);
throw ioe;
}
final int dimension = (currentState == null) ? -1 : currentState.length;
out.writeInt(dimension);
for (int i = 0; i < dimension; ++i) {
out.writeDouble(yDotKLast[0][i]);
out.writeDouble(yDotKLast[1][i]);
out.writeDouble(yDotKLast[2][i]);
}
// save the state of the base class
super.writeExternal(out);
}
/** {@inheritDoc} */
@Override
public void readExternal(final ObjectInput in)
throws IOException, ClassNotFoundException {
// read the local attributes
yDotKLast = new double[3][];
final int dimension = in.readInt();
yDotKLast[0] = (dimension < 0) ? null : new double[dimension];
yDotKLast[1] = (dimension < 0) ? null : new double[dimension];
yDotKLast[2] = (dimension < 0) ? null : new double[dimension];
for (int i = 0; i < dimension; ++i) {
yDotKLast[0][i] = in.readDouble();
yDotKLast[1][i] = in.readDouble();
yDotKLast[2][i] = in.readDouble();
}
// read the base state
super.readExternal(in);
}
}
| 19,955
|
Java
|
.java
| 390
| 42.464103
| 92
| 0.578698
|
andryr/symja
| 2
| 2
| 0
|
LGPL-3.0
|
9/5/2024, 12:05:04 AM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| true
| true
| true
| 19,955
|
61,835
|
Advancement.java
|
Luohuayu_CatServer/src/main/java/org/bukkit/advancement/Advancement.java
|
package org.bukkit.advancement;
import java.util.Collection;
import org.bukkit.Keyed;
import org.jetbrains.annotations.NotNull;
/**
* Represents an advancement that may be awarded to a player. This class is not
* reference safe as the underlying advancement may be reloaded.
*/
public interface Advancement extends Keyed {
/**
* Get all the criteria present in this advancement.
*
* @return a unmodifiable copy of all criteria
*/
@NotNull
Collection<String> getCriteria();
}
| 513
|
Java
|
.java
| 17
| 26.941176
| 79
| 0.750507
|
Luohuayu/CatServer
| 1,967
| 211
| 97
|
LGPL-3.0
|
9/4/2024, 7:04:55 PM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| false
| true
| true
| 513
|
1,821,135
|
KeyboardStatusChangedEvent.java
|
xframium_xframium-java/terminal-driver/src/main/java/com/bytezone/dm3270/application/KeyboardStatusChangedEvent.java
|
package com.bytezone.dm3270.application;
public final class KeyboardStatusChangedEvent
{
public final boolean insertMode;
public final boolean keyboardLocked;
public final String keyName;
public KeyboardStatusChangedEvent (boolean insertMode, boolean keyboardLocked,
String keyName)
{
this.insertMode = insertMode;
this.keyboardLocked = keyboardLocked;
this.keyName = keyName;
}
@Override
public String toString ()
{
StringBuilder text = new StringBuilder ();
text.append (String.format ("Keyboard locked ... %s%n", keyboardLocked));
text.append (String.format ("Insert mode on .... %s%n", insertMode));
text.append (String.format ("Key pressed ....... %s%n", keyName));
return text.toString ();
}
}
| 763
|
Java
|
.java
| 23
| 29.434783
| 80
| 0.729252
|
xframium/xframium-java
| 12
| 18
| 2
|
GPL-3.0
|
9/4/2024, 8:19:45 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 763
|
2,943,159
|
ArraySetDupesMultiMap.java
|
MIT-PAC_obj-sens-soot/src/soot/jimple/spark/ondemand/genericutil/ArraySetDupesMultiMap.java
|
/* Soot - a J*va Optimization Framework
* Copyright (C) 2007 Manu Sridharan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
package soot.jimple.spark.ondemand.genericutil;
import java.util.Set;
public class ArraySetDupesMultiMap<K,V> extends AbstractMultiMap<K,V> {
public ArraySetDupesMultiMap(boolean create) {
super(create);
}
public ArraySetDupesMultiMap() {
this(false);
}
@Override
protected Set<V> createSet() {
return new ArraySet<V>(1,false);
}
}
| 1,255
|
Java
|
.java
| 32
| 34.59375
| 71
| 0.740646
|
MIT-PAC/obj-sens-soot
| 5
| 1
| 0
|
LGPL-2.1
|
9/4/2024, 10:36:36 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 1,255
|
2,687,192
|
ThumbParamsOutputFilter.java
|
kaltura_KalturaGeneratedAPIClientsJava/src/main/java/com/kaltura/client/types/ThumbParamsOutputFilter.java
|
// ===================================================================================================
// _ __ _ _
// | |/ /__ _| | |_ _ _ _ _ __ _
// | ' </ _` | | _| || | '_/ _` |
// |_|\_\__,_|_|\__|\_,_|_| \__,_|
//
// This file is part of the Kaltura Collaborative Media Suite which allows users
// to do with audio, video, and animation what Wiki platforms allow them to do with
// text.
//
// Copyright (C) 2006-2023 Kaltura Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// @ignore
// ===================================================================================================
package com.kaltura.client.types;
import com.google.gson.JsonObject;
import com.kaltura.client.Params;
import com.kaltura.client.utils.request.MultiRequestBuilder;
/**
* This class was generated using generate.php
* against an XML schema provided by Kaltura.
*
* MANUAL CHANGES TO THIS CLASS WILL BE OVERWRITTEN.
*/
@SuppressWarnings("serial")
@MultiRequestBuilder.Tokenizer(ThumbParamsOutputFilter.Tokenizer.class)
public class ThumbParamsOutputFilter extends ThumbParamsOutputBaseFilter {
public interface Tokenizer extends ThumbParamsOutputBaseFilter.Tokenizer {
}
public ThumbParamsOutputFilter() {
super();
}
public ThumbParamsOutputFilter(JsonObject jsonObject) throws APIException {
super(jsonObject);
}
public Params toParams() {
Params kparams = super.toParams();
kparams.add("objectType", "KalturaThumbParamsOutputFilter");
return kparams;
}
}
| 2,223
|
Java
|
.java
| 54
| 39.5
| 102
| 0.634678
|
kaltura/KalturaGeneratedAPIClientsJava
| 6
| 11
| 1
|
AGPL-3.0
|
9/4/2024, 10:06:24 PM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| true
| true
| 2,223
|
3,007,403
|
StyleCacheEntry.java
|
jgneff_javafx-graphics/src/javafx.graphics/classes/com/sun/javafx/css/StyleCacheEntry.java
|
/*
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.javafx.css;
import javafx.css.PseudoClass;
import javafx.scene.text.Font;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
*
*/
public final class StyleCacheEntry {
public StyleCacheEntry() {
}
public CalculatedValue get(String property) {
CalculatedValue cv = null;
if (calculatedValues != null && ! calculatedValues.isEmpty()) {
cv = calculatedValues.get(property);
}
return cv;
}
public void put(String property, CalculatedValue calculatedValue) {
if (calculatedValues == null) {
this.calculatedValues = new HashMap<>(5);
}
calculatedValues.put(property, calculatedValue);
}
public final static class Key {
private final Set<PseudoClass>[] pseudoClassStates;
private final double fontSize;
private int hash = Integer.MIN_VALUE;
public Key(Set<PseudoClass>[] pseudoClassStates, Font font) {
this.pseudoClassStates = new Set[pseudoClassStates.length];
for (int n=0; n<pseudoClassStates.length; n++) {
this.pseudoClassStates[n] = new PseudoClassState();
this.pseudoClassStates[n].addAll(pseudoClassStates[n]);
}
this.fontSize = font != null ? font.getSize() : Font.getDefault().getSize();
}
@Override public String toString() {
return Arrays.toString(pseudoClassStates) + ", " + fontSize;
}
public static int hashCode(double value) {
long bits = Double.doubleToLongBits(value);
return (int)(bits ^ (bits >>> 32));
}
@Override
public int hashCode() {
if (hash == Integer.MIN_VALUE) {
hash = hashCode(fontSize);
final int iMax = pseudoClassStates != null ? pseudoClassStates.length : 0;
for (int i=0; i<iMax; i++) {
final Set<PseudoClass> states = pseudoClassStates[i];
if (states != null) {
hash = 67 * (hash + states.hashCode());
}
}
}
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null || obj.getClass() != this.getClass()) return false;
final Key other = (Key) obj;
if (this.hash != other.hash) return false;
//
// double == double is not reliable since a double is kind of
// a fuzzy value. And Double.compare is too precise.
// For javafx, most sizes are rounded to the nearest tenth
// (see SizeUnits.round) so comparing here to the nearest
// millionth is more than adequate.
//
// We assume that both fsize values are > 0, which is a safe assumption
// because Font doesn't allow sizes < 0.
final double diff = fontSize - other.fontSize;
// Math.abs(diff, 0.000001) is too slow
if (diff < -0.000001 || 0.000001 < diff) {
return false;
}
// either both must be null or both must be not-null
if ((pseudoClassStates == null) ^ (other.pseudoClassStates == null)) {
return false;
}
// if one is null, the other is too.
if (pseudoClassStates == null) {
return true;
}
if (pseudoClassStates.length != other.pseudoClassStates.length) {
return false;
}
for (int i=0; i<pseudoClassStates.length; i++) {
final Set<PseudoClass> this_pcs = pseudoClassStates[i];
final Set<PseudoClass> other_pcs = other.pseudoClassStates[i];
// if one is null, the other must be too
if (this_pcs == null ? other_pcs != null : !this_pcs.equals(other_pcs)) {
return false;
}
}
return true;
}
}
// private final Reference<StyleCacheEntry> sharedCacheRef;
private Map<String,CalculatedValue> calculatedValues;
// private CalculatedValue font; // for use in converting font relative sizes
}
| 5,580
|
Java
|
.java
| 129
| 33.751938
| 90
| 0.611819
|
jgneff/javafx-graphics
| 5
| 0
| 0
|
GPL-2.0
|
9/4/2024, 10:42:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 5,580
|
1,693,368
|
EaseQuadIn.java
|
delight-im_NationSoccer/AndEngine/src/org/andengine/util/modifier/ease/EaseQuadIn.java
|
package org.andengine.util.modifier.ease;
/**
* (c) 2010 Nicolas Gramlich
* (c) 2011 Zynga Inc.
*
* @author Gil
* @author Nicolas Gramlich
* @since 16:52:11 - 26.07.2010
*/
public class EaseQuadIn implements IEaseFunction {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private static EaseQuadIn INSTANCE;
// ===========================================================
// Constructors
// ===========================================================
private EaseQuadIn() {
}
public static EaseQuadIn getInstance() {
if (INSTANCE == null) {
INSTANCE = new EaseQuadIn();
}
return INSTANCE;
}
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public float getPercentage(final float pSecondsElapsed, final float pDuration) {
return EaseQuadIn.getValue(pSecondsElapsed / pDuration);
}
// ===========================================================
// Methods
// ===========================================================
public static float getValue(final float pPercentage) {
return pPercentage * pPercentage;
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
| 1,732
|
Java
|
.java
| 48
| 33.75
| 81
| 0.354877
|
delight-im/NationSoccer
| 14
| 8
| 0
|
GPL-2.0
|
9/4/2024, 8:14:49 PM (Europe/Amsterdam)
| true
| true
| true
| true
| true
| true
| true
| true
| 1,732
|
4,904,208
|
Usuarios.java
|
PillosMen_PuntoDeVenta/Version 1.0.0/src/Ventanas/Usuarios.java
|
package Ventanas;
import home.conectar;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public final class Usuarios extends javax.swing.JDialog {
public Usuarios(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
setLocationRelativeTo(null);
buscar("");
bloquear();
}
DefaultTableModel model;
conectar cc = new conectar();
Connection cn = cc.conexion();
public void buscar(String valor){
String [] titulos = {"ID","USUARIO","TIPO"};
String [] registros = new String[3];
String sql = "SELECT * FROM usuarios WHERE usuario LIKE '%"+valor+"%' ";
model = new DefaultTableModel(null,titulos);
try {
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
registros[0]=rs.getString("id");
registros[1]=rs.getString("usuario");
registros[2]=rs.getString("tipo");
model.addRow(registros);
}
tabla.setModel(model);
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this, ex, "ERROR", JOptionPane.ERROR_MESSAGE);
}
cc.cerrar();
}
public void bloquear(){
Guardar.setEnabled(false);
user.setEnabled(false);
pue.setEnabled(false);
password.setEnabled(false);
}
public void desbloquear(){
Guardar.setEnabled(true);
user.setEnabled(true);
pue.setEnabled(true);
password.setEnabled(true);
}
public void limpiar(){
user.setText(null);
pue.setSelectedItem("Seleccione");
password.setText(null);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
Aceptar = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
user = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
pue = new javax.swing.JComboBox();
password = new javax.swing.JPasswordField();
Guardar = new javax.swing.JButton();
Nuevo = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
tabla = new javax.swing.JTable();
Editar = new javax.swing.JButton();
Eliminar = new javax.swing.JButton();
Buscar = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Usuarios");
Aceptar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/aceptar16.png"))); // NOI18N
Aceptar.setText("ACEPTAR");
Aceptar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Aceptar.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
Aceptar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
Aceptar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
Aceptar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AceptarActionPerformed(evt);
}
});
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos"));
jLabel1.setText("Usuario");
jLabel2.setText("Puesto:");
jLabel3.setText("Contraseña:");
pue.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione", "Administrador", "Invitado" }));
Guardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/guardar16.png"))); // NOI18N
Guardar.setText("Guardar");
Guardar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Guardar.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
Guardar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
Guardar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
Guardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
GuardarActionPerformed(evt);
}
});
Nuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/agregar.png"))); // NOI18N
Nuevo.setText("Nuevo");
Nuevo.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Nuevo.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
Nuevo.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
Nuevo.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
Nuevo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NuevoActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel3)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(user)
.addComponent(pue, 0, 150, Short.MAX_VALUE)
.addComponent(password)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(Nuevo)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Guardar)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(user, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(pue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(31, 31, 31)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Guardar)
.addComponent(Nuevo))
.addContainerGap())
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Control"));
tabla.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3"
}
));
jScrollPane1.setViewportView(tabla);
Editar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/editar.png"))); // NOI18N
Editar.setText("Editar");
Editar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Editar.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
Editar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
Editar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
Eliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/eliminar.png"))); // NOI18N
Eliminar.setText("Eliminar");
Eliminar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Eliminar.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
Eliminar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
Eliminar.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(Editar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Buscar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Eliminar)))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Editar)
.addComponent(Eliminar)
.addComponent(Buscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Aceptar)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 32, Short.MAX_VALUE)
.addComponent(Aceptar)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void AceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AceptarActionPerformed
setVisible(false);
}//GEN-LAST:event_AceptarActionPerformed
private void NuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NuevoActionPerformed
desbloquear();
Nuevo.setEnabled(false);
user.requestFocus();
}//GEN-LAST:event_NuevoActionPerformed
private void GuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GuardarActionPerformed
String usuario, puesto, contraseña;
String sql;
usuario = user.getText();
puesto = (String) pue.getSelectedItem();
contraseña = password.getText();
sql="INSERT INTO usuarios (usuario, contraseña, tipo) VALUES(?,?,?)";
try {
PreparedStatement ps = cn.prepareStatement(sql);
ps.setString(1, usuario);
ps.setString(2, contraseña);
ps.setString(3, puesto);
int n = ps.executeUpdate();
if(n>0){
JOptionPane.showMessageDialog(this, "Se Guardo Con Exito!!!", "INFORMATION", JOptionPane.INFORMATION_MESSAGE);
bloquear();
limpiar();
Nuevo.setEnabled(true);
buscar("");
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this, ex, "ERROR", JOptionPane.ERROR_MESSAGE);
}
cc.cerrar();
}//GEN-LAST:event_GuardarActionPerformed
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Usuarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Usuarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Usuarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Usuarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
Usuarios dialog = new Usuarios(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Aceptar;
private javax.swing.JTextField Buscar;
private javax.swing.JButton Editar;
private javax.swing.JButton Eliminar;
private javax.swing.JButton Guardar;
private javax.swing.JButton Nuevo;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JPasswordField password;
private javax.swing.JComboBox pue;
private javax.swing.JTable tabla;
private javax.swing.JTextField user;
// End of variables declaration//GEN-END:variables
}
| 17,705
|
Java
|
.java
| 326
| 41.745399
| 162
| 0.652849
|
PillosMen/PuntoDeVenta
| 1
| 4
| 0
|
GPL-2.0
|
9/5/2024, 12:35:26 AM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| false
| true
| 17,700
|
1,318,880
|
A_test612.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/expression_out/A_test612.java
|
package expression_out;
public class A_test612 {
class Inner {
}
public void foo() {
Inner[] inner= extracted();
}
protected Inner[] extracted() {
return /*[*/new Inner[10]/*]*/;
}
}
| 194
|
Java
|
.java
| 11
| 15.636364
| 33
| 0.659341
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 194
|
1,315,050
|
A.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/RenameNonPrivateField/testBug5821/in/A.java
|
package p;
public class A {
public int test = 0;
public static void main(String[] args) {
A test = new A();
test.test = 1;
}
}
| 157
|
Java
|
.java
| 8
| 14.875
| 44
| 0.557823
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 157
|
2,061,974
|
JMods.java
|
openjdk_jdk6/jaxws/drop_included/jaxws_src/src/com/sun/codemodel/internal/JMods.java
|
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.codemodel.internal;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* Modifier groups.
*/
public class JMods implements JGenerable {
//
// mask
//
private static int VAR
= JMod.FINAL;
private static int FIELD
= (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED
| JMod.STATIC | JMod.FINAL
| JMod.TRANSIENT | JMod.VOLATILE);
private static int METHOD
= (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED | JMod.FINAL
| JMod.ABSTRACT | JMod.STATIC | JMod.NATIVE | JMod.SYNCHRONIZED);
private static int CLASS
= (JMod.PUBLIC | JMod.PRIVATE | JMod.PROTECTED
| JMod.STATIC | JMod.FINAL | JMod.ABSTRACT );
private static int INTERFACE = JMod.PUBLIC;
/** bit-packed representation of modifiers. */
private int mods;
private JMods(int mods) {
this.mods = mods;
}
/**
* Gets the bit-packed representaion of modifiers.
*/
public int getValue() {
return mods;
}
private static void check(int mods, int legal, String what) {
if ((mods & ~legal) != 0)
throw new IllegalArgumentException("Illegal modifiers for "
+ what + ": "
+ new JMods(mods).toString());
/* ## check for illegal combinations too */
}
static JMods forVar(int mods) {
check(mods, VAR, "variable");
return new JMods(mods);
}
static JMods forField(int mods) {
check(mods, FIELD, "field");
return new JMods(mods);
}
static JMods forMethod(int mods) {
check(mods, METHOD, "method");
return new JMods(mods);
}
static JMods forClass(int mods) {
check(mods, CLASS, "class");
return new JMods(mods);
}
static JMods forInterface(int mods) {
check(mods, INTERFACE, "class");
return new JMods(mods);
}
public boolean isAbstract() {
return (mods & JMod.ABSTRACT) != 0;
}
public boolean isNative() {
return (mods & JMod.NATIVE) != 0;
}
public boolean isSynchronized() {
return (mods & JMod.SYNCHRONIZED) != 0;
}
public void setSynchronized(boolean newValue) {
setFlag( JMod.SYNCHRONIZED, newValue );
}
// TODO: more
private void setFlag( int bit, boolean newValue ) {
mods = (mods & ~bit) | (newValue?bit:0);
}
public void generate(JFormatter f) {
if ((mods & JMod.PUBLIC) != 0) f.p("public");
if ((mods & JMod.PROTECTED) != 0) f.p("protected");
if ((mods & JMod.PRIVATE) != 0) f.p("private");
if ((mods & JMod.FINAL) != 0) f.p("final");
if ((mods & JMod.STATIC) != 0) f.p("static");
if ((mods & JMod.ABSTRACT) != 0) f.p("abstract");
if ((mods & JMod.NATIVE) != 0) f.p("native");
if ((mods & JMod.SYNCHRONIZED) != 0) f.p("synchronized");
if ((mods & JMod.TRANSIENT) != 0) f.p("transient");
if ((mods & JMod.VOLATILE) != 0) f.p("volatile");
}
public String toString() {
StringWriter s = new StringWriter();
JFormatter f = new JFormatter(new PrintWriter(s));
this.generate(f);
return s.toString();
}
}
| 4,512
|
Java
|
.java
| 120
| 31.516667
| 79
| 0.630011
|
openjdk/jdk6
| 19
| 18
| 0
|
GPL-2.0
|
9/4/2024, 8:28:13 PM (Europe/Amsterdam)
| false
| true
| true
| true
| false
| true
| true
| true
| 4,512
|
1,057,491
|
Polynomial.java
|
s-andrews_SeqMonk/edu/northwestern/at/utils/math/Polynomial.java
|
package edu.northwestern.at.utils.math;
/* Please see the license information at the end of this file. */
/** Polynomial functions.
*/
public class Polynomial
{
/** Evaluate a polynomial expression using Horner's method.
*
* @param polycoefs Array of polynomial coefficients.
* The coefficients should be ordered
* with the constant term first and the
* coefficient for the highest powered term
* last.
*
* @param x Value for which to evaluate polynomial.
*
* @return Polynomial evaluated using Horner's method.
*
* <p>
* Horner's method is given by the following recurrence relation:
* c[i]*x^i + ... + c[1]*x + c[0] = c[0] + x*(c[i-1]*x^[i-1] + ... + c[1])
* </p>
*
* <p>
* Horner's method avoids loss of precision which can occur
* when the higher-power values of x are computed directly.
* </p>
*/
public static double hornersMethod( double polycoefs[] , double x )
{
double result = 0.0;
for ( int i = polycoefs.length - 1 ; i >= 0 ; i-- )
{
result = result * x + polycoefs[ i ] ;
}
return result;
}
/** Evaluates a Chebyschev series.
*
* @param coeffs The Chebyschev polynomial coefficients.
*
* @param x The value for which to evaluate
* the polynomial.
*
* @return The Chebyschev polynomial evaluated
* at x.
*/
public static double evaluateChebyschev
(
double coeffs[] ,
double x
)
{
double b0;
double b1;
double b2;
double twox;
int i;
b0 = 0.0D;
b1 = 0.0D;
b2 = 0.0D;
twox = x + x;
for ( i = coeffs.length - 1 ; i >= 0 ; i-- )
{
b2 = b1;
b1 = b0;
b0 = twox * b1 - b2 + coeffs[ i ];
}
return 0.5D * ( b0 - b2 );
}
/** Don't allow instantiation but do allow overrides.
*/
protected Polynomial()
{
}
}
/*
* <p>
* Copyright © 2004-2011 Northwestern University.
* </p>
* <p>
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* </p>
* <p>
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more
* details.
* </p>
* <p>
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA.
* </p>
*/
| 2,645
|
Java
|
.java
| 100
| 23.7
| 75
| 0.65981
|
s-andrews/SeqMonk
| 47
| 9
| 32
|
GPL-2.0
|
9/4/2024, 7:11:02 PM (Europe/Amsterdam)
| true
| true
| true
| true
| true
| true
| true
| true
| 2,645
|
4,473,784
|
SRUArgumentParseException.java
|
GeoscienceAustralia_FSDF-Metadata-Tool/core/src/main/java/org/fao/geonet/services/util/z3950/SRUArgumentParseException.java
|
/*
* Copyright (C) 2001-2016 Food and Agriculture Organization of the
* United Nations (FAO-UN), United Nations World Food Programme (WFP)
* and United Nations Environment Programme (UNEP)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
* Rome - Italy. email: [email protected]
*/
package org.fao.geonet.services.util.z3950;
public class SRUArgumentParseException extends Exception {
private static final long serialVersionUID = 1L;
private String type;
private String val;
public SRUArgumentParseException(String type, String val, Exception e) {
super(e);
this.val = val;
this.type = type;
}
public String getType() {
return type;
}
public String getVal() {
return val;
}
}
| 1,504
|
Java
|
.java
| 39
| 34.948718
| 76
| 0.734247
|
GeoscienceAustralia/FSDF-Metadata-Tool
| 2
| 0
| 0
|
GPL-2.0
|
9/5/2024, 12:14:28 AM (Europe/Amsterdam)
| false
| false
| false
| true
| false
| true
| false
| true
| 1,504
|
2,002,505
|
AFactoryImpl.java
|
eclipse_kitalpha/architecture description/core/tests/usecase1/a.a/src/A/A/impl/AFactoryImpl.java
|
package A.A.impl;
import A.A.*;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class AFactoryImpl extends EFactoryImpl implements AFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static AFactory init() {
try {
AFactory theAFactory = (AFactory) EPackage.Registry.INSTANCE.getEFactory(APackage.eNS_URI);
if (theAFactory != null) {
return theAFactory;
}
} catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new AFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case APackage.ROOT:
return createroot();
case APackage.ACHLID:
return createAChlid();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public root createroot() {
rootImpl root = new rootImpl();
return root;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AChlid createAChlid() {
AChlidImpl aChlid = new AChlidImpl();
return aChlid;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public APackage getAPackage() {
return (APackage) getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static APackage getPackage() {
return APackage.eINSTANCE;
}
} //AFactoryImpl
| 2,130
|
Java
|
.java
| 93
| 20.182796
| 132
| 0.653162
|
eclipse/kitalpha
| 10
| 23
| 68
|
EPL-2.0
|
9/4/2024, 8:26:17 PM (Europe/Amsterdam)
| false
| true
| false
| true
| false
| true
| true
| true
| 2,130
|
4,077,908
|
MouseTrackerFrame.java
|
obulpathi_java/deitel/ch14/fig14_28_29/MouseTrackerFrame.java
|
// Fig. 14.28: MouseTrackerFrame.java
// Demonstrating mouse events.
import java.awt.Color;
import java.awt.BorderLayout;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseEvent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class MouseTrackerFrame extends JFrame
{
private JPanel mousePanel; // panel in which mouse events will occur
private JLabel statusBar; // label that displays event information
// MouseTrackerFrame constructor sets up GUI and
// registers mouse event handlers
public MouseTrackerFrame()
{
super( "Demonstrating Mouse Events" );
mousePanel = new JPanel(); // create panel
mousePanel.setBackground( Color.WHITE ); // set background color
add( mousePanel, BorderLayout.CENTER ); // add panel to JFrame
statusBar = new JLabel( "Mouse outside JPanel" );
add( statusBar, BorderLayout.SOUTH ); // add label to JFrame
// create and register listener for mouse and mouse motion events
MouseHandler handler = new MouseHandler();
mousePanel.addMouseListener( handler );
mousePanel.addMouseMotionListener( handler );
} // end MouseTrackerFrame constructor
private class MouseHandler implements MouseListener,
MouseMotionListener
{
// MouseListener event handlers
// handle event when mouse released immediately after press
public void mouseClicked( MouseEvent event )
{
statusBar.setText( String.format( "Clicked at [%d, %d]",
event.getX(), event.getY() ) );
} // end method mouseClicked
// handle event when mouse pressed
public void mousePressed( MouseEvent event )
{
statusBar.setText( String.format( "Pressed at [%d, %d]",
event.getX(), event.getY() ) );
} // end method mousePressed
// handle event when mouse released
public void mouseReleased( MouseEvent event )
{
statusBar.setText( String.format( "Released at [%d, %d]",
event.getX(), event.getY() ) );
} // end method mouseReleased
// handle event when mouse enters area
public void mouseEntered( MouseEvent event )
{
statusBar.setText( String.format( "Mouse entered at [%d, %d]",
event.getX(), event.getY() ) );
mousePanel.setBackground( Color.GREEN );
} // end method mouseEntered
// handle event when mouse exits area
public void mouseExited( MouseEvent event )
{
statusBar.setText( "Mouse outside JPanel" );
mousePanel.setBackground( Color.WHITE );
} // end method mouseExited
// MouseMotionListener event handlers
// handle event when user drags mouse with button pressed
public void mouseDragged( MouseEvent event )
{
statusBar.setText( String.format( "Dragged at [%d, %d]",
event.getX(), event.getY() ) );
} // end method mouseDragged
// handle event when user moves mouse
public void mouseMoved( MouseEvent event )
{
statusBar.setText( String.format( "Moved at [%d, %d]",
event.getX(), event.getY() ) );
} // end method mouseMoved
} // end inner class MouseHandler
} // end class MouseTrackerFrame
/**************************************************************************
* (C) Copyright 1992-2012 by Deitel & Associates, Inc. and *
* Pearson Education, Inc. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/
| 4,504
|
Java
|
.java
| 93
| 41.247312
| 76
| 0.624401
|
obulpathi/java
| 2
| 1
| 0
|
GPL-3.0
|
9/5/2024, 12:02:04 AM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| true
| true
| 4,504
|
1,319,054
|
A_test551.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/locals_in/A_test551.java
|
package locals_in;
public class A_test551 {
public void foo() {
int i= 0;
do {
/*[*/i++;/*]*/
} while (true);
}
}
| 128
|
Java
|
.java
| 9
| 11.666667
| 24
| 0.551724
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 128
|
1,319,628
|
A_test554.java
|
eclipse-jdt_eclipse_jdt_ui/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/locals_out/A_test554.java
|
package locals_out;
public class A_test554 {
public boolean flag;
public void foo() {
int x;
extracted();
x= 20;
}
protected void extracted() {
int x;
/*[*/if (flag)
x= 10;/*]*/
}
}
| 202
|
Java
|
.java
| 14
| 12
| 29
| 0.623656
|
eclipse-jdt/eclipse.jdt.ui
| 35
| 86
| 242
|
EPL-2.0
|
9/4/2024, 7:34:16 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 202
|
2,641,606
|
SandboxedProcessService35.java
|
luanon404_awChromium/aw_chromium/src/main/java/org/chromium/content/app/SandboxedProcessService35.java
|
// THIS FILE IS GENERATED BY generate_child_service.py
package org.chromium.content.app;
/**
* This is needed to register multiple SandboxedProcess services so that we
* can have more than one sandboxed process.
*/
public class SandboxedProcessService35 extends SandboxedProcessService {
}
| 294
|
Java
|
.java
| 8
| 35.25
| 75
| 0.817544
|
luanon404/awChromium
| 7
| 3
| 0
|
GPL-3.0
|
9/4/2024, 9:53:43 PM (Europe/Amsterdam)
| false
| true
| false
| true
| true
| true
| true
| true
| 294
|
572,385
|
CountedStat.java
|
the8472_mldht/src/lbms/plugins/mldht/kad/tasks/CountedStat.java
|
/*******************************************************************************
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
******************************************************************************/
package lbms.plugins.mldht.kad.tasks;
enum CountedStat {
SENT,
RECEIVED,
STALLED,
FAILED,
SENT_SINCE_RECEIVE
}
| 481
|
Java
|
.java
| 13
| 35.230769
| 80
| 0.496788
|
the8472/mldht
| 147
| 45
| 7
|
MPL-2.0
|
9/4/2024, 7:08:18 PM (Europe/Amsterdam)
| false
| false
| true
| true
| true
| true
| true
| true
| 481
|
3,596,958
|
SWTResourceCompositeData.java
|
TANGO-Project_code-profiler-plugin/bundles/org.jvmmonitor.agent/src/org/jvmmonitor/internal/agent/SWTResourceCompositeData.java
|
/*******************************************************************************
* Copyright (c) 2011 JVM Monitor project. All rights reserved.
*
* This code is distributed under the terms of the Eclipse Public License v1.0
* which is available at http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.jvmmonitor.internal.agent;
import java.beans.ConstructorProperties;
import java.util.List;
/**
* The SWT resource that is converted into <tt>CompositeData</tt>.
*/
public class SWTResourceCompositeData {
/** The resource name that is given by Resource.toString(). */
private String name;
/** The stack traces to show how the resource was created. */
private List<StackTraceElementCompositeData> stackTrace;
/**
* The constructor.
*
* @param name
* The resource name
* @param stackTrace
* The stack trace
*/
@ConstructorProperties({ "name", "stackTrace" })
public SWTResourceCompositeData(String name,
List<StackTraceElementCompositeData> stackTrace) {
this.name = name;
this.stackTrace = stackTrace;
}
/**
* Gets the resource name.
*
* @return The resource name
*/
public String getName() {
return name;
}
/**
* Gets the stack trace.
*
* @return The stack trace
*/
public List<StackTraceElementCompositeData> getStackTrace() {
return stackTrace;
}
}
| 1,549
|
Java
|
.java
| 48
| 27.229167
| 81
| 0.591031
|
TANGO-Project/code-profiler-plugin
| 3
| 1
| 0
|
EPL-2.0
|
9/4/2024, 11:34:47 PM (Europe/Amsterdam)
| false
| false
| true
| true
| false
| true
| true
| true
| 1,549
|
4,571,075
|
ResourceB.java
|
AcornPublishing_oauth-2-cookbook/Chapter08/validate-audience/resource-server-b/src/main/java/com/packt/example/resourceserverb/ResourceB.java
|
package com.packt.example.resourceserverb;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Configuration
@Controller
@EnableResourceServer
public class ResourceB extends ResourceServerConfigurerAdapter {
@Override
public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
resources.resourceId("resource-b");
}
@Override
public void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().authenticated().and()
.requestMatchers().antMatchers("/res-b");
}
@RequestMapping("/res-b")
public ResponseEntity<String> resourceB() {
return ResponseEntity.ok("resource B with success");
}
}
| 1,296
|
Java
|
.java
| 27
| 44.111111
| 111
| 0.820269
|
AcornPublishing/oauth-2-cookbook
| 2
| 0
| 0
|
GPL-3.0
|
9/5/2024, 12:17:49 AM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| false
| true
| true
| 1,296
|
4,327,493
|
ForControlIndexMark.java
|
YeeYoungHan_springsample/TestHwp/src/main/java/kr/dogfoot/hwplib/writer/bodytext/paragraph/control/ForControlIndexMark.java
|
package kr.dogfoot.hwplib.writer.bodytext.paragraph.control;
import kr.dogfoot.hwplib.object.bodytext.control.ControlIndexMark;
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.CtrlHeaderIndexMark;
import kr.dogfoot.hwplib.object.etc.HWPTag;
import kr.dogfoot.hwplib.util.StringUtil;
import kr.dogfoot.hwplib.util.compoundFile.writer.StreamWriter;
import java.io.IOException;
/**
* 찾아보기 표식 컨트롤을 쓰기 위한 객체
*
* @author neolord
*/
public class ForControlIndexMark {
/**
* 찾아보기 표식 컨트롤을 쓴다.
*
* @param im 찾아보기 표식 컨트롤
* @param sw 스트림 라이터
* @throws IOException
*/
public static void write(ControlIndexMark im, StreamWriter sw)
throws IOException {
ctrlHeader(im.getHeader(), sw);
}
/**
* 찾아보기 표식 컨트롤의 컨트롤 헤더 레코드를 쓴다.
*
* @param h 찾아보기 표식 컨트롤의 컨트롤 헤더 레코드
* @param sw 스트림 라이터
* @throws IOException
*/
private static void ctrlHeader(CtrlHeaderIndexMark h, StreamWriter sw)
throws IOException {
recordHeader(h, sw);
sw.writeUInt4(h.getCtrlId());
sw.writeUTF16LEString(h.getKeyword1());
sw.writeUTF16LEString(h.getKeyword2());
}
/**
* 컨트롤 헤더 레코드의 레코드 헤더를 쓴다.
*
* @param h 컨트롤 헤더 레코드
* @param sw 스트림 라이터
* @throws IOException
*/
private static void recordHeader(CtrlHeaderIndexMark h, StreamWriter sw)
throws IOException {
sw.writeRecordHeader(HWPTag.CTRL_HEADER, getSize(h));
}
/**
* 컨트롤 헤더 레코드의 크기를 반환한다.
*
* @param h 컨트롤 헤더 레코드
* @return 컨트롤 헤더 레코드의 크기
*/
private static int getSize(CtrlHeaderIndexMark h) {
int size = 0;
size += 4;
size += StringUtil.getUTF16LEStringSize(h.getKeyword1());
size += StringUtil.getUTF16LEStringSize(h.getKeyword2());
return size;
}
}
| 2,174
|
Java
|
.java
| 63
| 23.888889
| 80
| 0.658686
|
YeeYoungHan/springsample
| 2
| 5
| 2
|
GPL-3.0
|
9/5/2024, 12:09:19 AM (Europe/Amsterdam)
| false
| false
| false
| true
| true
| true
| true
| true
| 1,866
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.