- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
class GridPanel extends JPanel {
protected Point myLocation;
@Override
public Point location() {
return this.myLocation;
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+146
class GridPanel extends JPanel {
protected Point myLocation;
@Override
public Point location() {
return this.myLocation;
}
}
убивал бы за такое.
+146
protected void displayBoard() {
for (int i = 0; i < this.viewArea.getComponentCount(); i++) {
Component next = this.viewArea.getComponent(i);
next.paint(next.getGraphics());
}
try {
Thread.currentThread();
Thread.sleep(50);
} catch (Exception e) {
}
}
странный код. Особенно не понял строку 7
+69
for(int i=0;i<1000;i++){
MyThread t = new MyThread();
t.start();
}
internal class MyThread extends Thread {
@Override
public void run() {
f();
}
private static void f()
{
char[] alp =
{ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f',
'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm'};
try
{
String name = "";
String text = "";
Random r = new Random();
for(int i = 1;i<10;i++)
{
name += alp[r.nextInt(alp.length)];
}
for(int i = 1;i<1000;i++)
{
text += alp[r.nextInt(alp.length)];
}
FileWriter fstream = new FileWriter("c:/mydak/"+name+".txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write("Mydak, ti eto dolgo budesh isKATb "+text);
out.close();
f();
} catch (IOException e)
{
e.printStackTrace();
}
}
}
Не говнокод, но улыбку вызывает =)
По ТЗ программа "работает не корректно. Исправить." вот как оно бывает..
+71
return res != null ? res : null;
тавтология :)
+84
/*
* Copyright 2003-2009 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.codehaus.groovy.runtime;
public class ArrayUtil {
private static final Object[] EMPTY = new Object[0]
;
public static Object[] createArray() {
return EMPTY;
}
public static Object[] createArray(Object arg0) {
return new Object[]{
arg0};
}
public static Object[] createArray(Object arg0, Object arg1) {
return new Object[]{
arg0, arg1};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2) {
return new Object[]{
arg0, arg1, arg2};
}
.......................................................
public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14, Object arg15, Object arg16, Object arg17, Object arg18, Object arg19, Object arg20, Object arg21, Object arg22, Object arg23, Object arg24, Object arg25, Object arg26, Object arg27, Object arg28, Object arg29, Object arg30, Object arg31, Object arg32, Object arg33, Object arg34, Object arg35, Object arg36, Object arg37, Object arg38, Object arg39, Object arg40, Object arg41, Object arg42, Object arg43, Object arg44, Object arg45, Object arg46, Object arg47, Object arg48, Object arg49, Object arg50, Object arg51, Object arg52, Object arg53, Object arg54, Object arg55, Object arg56, Object arg57, Object arg58, Object arg59, Object arg60, Object arg61, Object arg62, Object arg63, Object arg64, Object arg65, Object arg66, Object arg67, Object arg68, Object arg69, Object arg70, Object arg71, Object arg72, Object arg73, Object arg74, Object arg75, Object arg76, Object arg77, Object arg78, Object arg79, Object arg80, Object arg81, Object arg82, Object arg83, Object arg84, Object arg85, Object arg86, Object arg87, Object arg88, Object arg89, Object arg90, Object arg91, Object arg92, Object arg93, Object arg94, Object arg95, Object arg96, Object arg97, Object arg98, Object arg99, Object arg100) {
return new Object[]{
arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29, arg30, arg31, arg32, arg33, arg34, arg35, arg36, arg37, arg38, arg39, arg40, arg41, arg42, arg43, arg44, arg45, arg46, arg47, arg48, arg49, arg50, arg51, arg52, arg53, arg54, arg55, arg56, arg57, arg58, arg59, arg60, arg61, arg62, arg63, arg64, arg65, arg66, arg67, arg68, arg69, arg70, arg71, arg72, arg73, arg74, arg75, arg76, arg77, arg78, arg79, arg80, arg81, arg82, arg83, arg84, arg85, arg86, arg87, arg88, arg89, arg90, arg91, arg92, arg93, arg94, arg95, arg96, arg97, arg98, arg99, arg100};
}
вот такой он - groovy
+80
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w(TAG, "Upgrading database from version " + oldVersion + " + newVersion);
db.execSQL("DROP TABLE IF EXISTS " + mTableName);
onCreate(db);
}
Обновление базы данных. Из одного проекта под андроид.
−89
try {
throw new Exception("TRANSACTION IS OPENED");
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
реальный проект
+75
public static String join(String delimiter, String... str) {
StringBuilder buffer = new StringBuilder();
for (String s : str) {
if (!"".equals(s)) {
if (buffer.length() != 0) {
buffer.append(delimiter);
}
buffer.append(s);
}
}
return buffer.toString();
}
String str = (H.join(" на ", category, H.join(" ", super.getMark().toUpperCase(), super.getModel().toUpperCase())) + " " + super.getFrame().toUpperCase() + " " + super.getEngine().toUpperCase()).trim();
чувак явно знает толк в извращениях
+73
NumberUtils.notNull(null)
люблю такие конструкции =)
+83
private double calculateValue( int number, int rate ) {
return Math.pow( number, rate );
}